Commit e10e7f57 authored by Bruno Martin's avatar Bruno Martin
Browse files

add chat_url and id to relializer

parent 51b0caa9
......@@ -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):
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment