Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
e10e7f57
Commit
e10e7f57
authored
Jul 27, 2020
by
Bruno Martin
Browse files
add chat_url and id to relializer
parent
51b0caa9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
courses/classroom/models.py
courses/classroom/models.py
+5
-1
courses/classroom/serializers.py
courses/classroom/serializers.py
+3
-3
No files found.
courses/classroom/models.py
View file @
e10e7f57
...
...
@@ -61,7 +61,11 @@ class Classroom(models.Model):
)
def
__str__
(
self
):
return
'{} @ {}'
.
format
(
self
.
name
,
self
.
course
)
return
'{} @ {}'
.
format
(
self
.
name
,
self
.
assistants
.
first
())
@
property
def
chat_url
(
self
):
return
'{}/channel/{}'
.
format
(
settings
.
ROCKET_CHAT
.
address
,
group
.
chatroom_set
.
first
().
room
)
class
Event
(
models
.
Model
):
...
...
courses/classroom/serializers.py
View file @
e10e7f57
...
...
@@ -22,6 +22,7 @@ class BasicClassroomSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Classroom
fields
=
(
'id'
,
'name'
,
'description'
,
'image'
,
...
...
@@ -35,8 +36,7 @@ class ClassroomSerializer(serializers.ModelSerializer):
assistants
=
SimpleUserSerializer
(
read_only
=
True
,
many
=
True
)
coordinators
=
SimpleUserSerializer
(
read_only
=
True
,
many
=
True
)
events
=
EventSerializer
(
read_only
=
True
,
many
=
True
)
courses
=
BasicCourseSerializer
(
read_only
=
True
)
# turma_iat = TurmaiatSerializer(read_only=True)
courses
=
BasicCourseSerializer
(
read_only
=
True
,
many
=
True
)
class
Meta
:
model
=
Classroom
...
...
@@ -50,6 +50,6 @@ class ClassroomSerializer(serializers.ModelSerializer):
'access_groups'
,
'group'
,
'events'
,
'
turma_iat
'
,
'
chat_url
'
,
)
depth
=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment