Commit cd35a8d2 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Fix message filter

parent 29730d53
...@@ -175,18 +175,13 @@ class ProfessorMessageViewSet(viewsets.ModelViewSet): ...@@ -175,18 +175,13 @@ class ProfessorMessageViewSet(viewsets.ModelViewSet):
def get_queryset(self): def get_queryset(self):
queryset = super().get_queryset() queryset = super().get_queryset()
# all_messages = self.request.query_params.get('all_messages', None)
# if all_messages: query = Q(
# queryset = queryset.order_by('-id').distinct() Q(users=self.request.user)
| Q(groups__in=self.request.user.groups.all())
# else: | Q(professor=self.request.user)
# query = Q( )
# Q(users=self.request.user) queryset = queryset.filter(query).order_by('-id').distinct()
# | Q(groups__in=self.request.user.groups.all())
# | Q(professor=self.request.user)
# )
# queryset = queryset.filter(query).order_by('-id').distinct()
queryset = queryset.order_by('-id').distinct()
classroom = self.request.query_params.get('classroom', None) classroom = self.request.query_params.get('classroom', None)
if classroom: if classroom:
......
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