Commit 099c72c3bfe33d4133079123437b3bdc309cf23f
1 parent
0838e0ca
Exists in
master
and in
3 other branches
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,13 +41,10 @@ class HomeView(LoginRequiredMixin, ListView): | ||
41 | if self.request.user.is_staff: | 41 | if self.request.user.is_staff: |
42 | subjects = Subject.objects.all().order_by("name") | 42 | subjects = Subject.objects.all().order_by("name") |
43 | else: | 43 | else: |
44 | - | ||
45 | - | ||
46 | pk = self.request.user.pk | 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 | return subjects | 48 | return subjects |
52 | 49 | ||
53 | def get_context_data(self, **kwargs): | 50 | def get_context_data(self, **kwargs): |