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

add forum to classroom serializer

parent d183cb6f
......@@ -4,6 +4,8 @@ from baquara.users.serializers import SimpleUserSerializer
from courses.serializers import BasicCourseSerializer
from discussion.serializers import ForumSumarySerializer
from .models import Classroom, Event
......@@ -37,6 +39,7 @@ class ClassroomSerializer(serializers.ModelSerializer):
coordinators = SimpleUserSerializer(read_only=True, many=True)
events = EventSerializer(read_only=True, many=True)
courses = BasicCourseSerializer(read_only=True, many=True)
forum = ForumSumarySerializer(read_only=True)
class Meta:
model = Classroom
......@@ -51,5 +54,6 @@ class ClassroomSerializer(serializers.ModelSerializer):
'group',
'events',
'chat_url',
'forum',
)
depth = 1
......@@ -37,6 +37,10 @@ class BasicClassroomViewSet(viewsets.ReadOnlyModelViewSet):
| Q(coordinators=self.request.user)
)
queryset = queryset.select_related(
'forum',
'group',
)
queryset = queryset.prefetch_related(
'assistants',
'coordinators',
......
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