Skip to content

Commit

Permalink
change queryset to prevent duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrzejMorawski00 committed Nov 27, 2024
1 parent b43bdd3 commit 7aa8c50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zapisy/apps/theses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ class ThesesQuerySet(models.QuerySet):
def visible(self, user):
if user.is_staff or is_theses_board_member(user):
return self
student_theses = self.filter(students__user=user)
return self.filter(
(~Q(status=ThesisStatus.BEING_EVALUATED) & ~Q(status=ThesisStatus.RETURNED_FOR_CORRECTIONS)) |
Q(advisor__user=user) |
Q(supporting_advisor__user=user) |
Q(students__user=user)).distinct()
Q(id__in=student_theses))


class Thesis(models.Model):
Expand Down

0 comments on commit 7aa8c50

Please sign in to comment.