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

avoid duplicated classrooms and grant access to access_groups

parent a6108363
......@@ -37,6 +37,7 @@ class BasicClassroomViewSet(viewsets.ReadOnlyModelViewSet):
if not self.request.user.is_superuser:
queryset = queryset.filter(
Q(group__in=self.request.user.groups.all())
| Q(access_groups__in=self.request.user.groups.all())
| Q(assistants=self.request.user)
| Q(coordinators=self.request.user)
)
......@@ -53,7 +54,7 @@ class BasicClassroomViewSet(viewsets.ReadOnlyModelViewSet):
'events',
)
return queryset
return queryset.distinct()
class ClassroomViewSet(BasicClassroomViewSet, viewsets.ModelViewSet):
......
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