Commit 7dcbf6fb authored by Matheus Miranda's avatar Matheus Miranda

Merge branch 'develop' into 'master'

Fix messages visualization

See merge request !49
parents 8240405d 0464c091
......@@ -766,7 +766,7 @@ class ProfessorMessage(models.Model):
)
def __str__(self):
return self.professor.name + " - " + self.subject + " - " + str(self.date)
return self.subject + " - " + str(self.date)
def send(self):
# bcc = list with all destinataries
......
......@@ -173,17 +173,18 @@ class ProfessorMessageViewSet(viewsets.ModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
all_messages = self.request.query_params.get('all_messages', None)
if all_messages:
queryset = queryset.order_by('-id').distinct()
# all_messages = self.request.query_params.get('all_messages', None)
# if all_messages:
# queryset = queryset.order_by('-id').distinct()
else:
query = Q(
Q(users=self.request.user)
| Q(groups__in=self.request.user.groups.all())
| Q(professor=self.request.user)
)
queryset = queryset.filter(query).order_by('-id').distinct()
# else:
# query = Q(
# Q(users=self.request.user)
# | 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)
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