Commit 099c72c3bfe33d4133079123437b3bdc309cf23f

Authored by Zambom
1 parent 0838e0ca

Adjusting duplicated rows in home

Showing 1 changed file with 1 additions and 4 deletions   Show diff stats
subjects/views.py
... ... @@ -41,13 +41,10 @@ class HomeView(LoginRequiredMixin, ListView):
41 41 if self.request.user.is_staff:
42 42 subjects = Subject.objects.all().order_by("name")
43 43 else:
44   -
45   -
46 44 pk = self.request.user.pk
47 45  
48   - subjects = Subject.objects.filter(students__pk=pk) | Subject.objects.filter(professor__pk=pk) | Subject.objects.filter(category__coordinators__pk=pk)
  46 + subjects = Subject.objects.filter(Q(students__pk=pk) | Q(professor__pk=pk) | Q(category__coordinators__pk=pk)).distinct()
49 47  
50   -
51 48 return subjects
52 49  
53 50 def get_context_data(self, **kwargs):
... ...