Commit 289bd78f5a47cbe6b437c17dd5fe955749fefa7b

Authored by Matheus Lins
1 parent 501a30d0

specific course's filter in view for students and teacher

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
courses/views.py
... ... @@ -24,13 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
24 24 redirect_field_name = 'next'
25 25 queryset = Course.objects.all()
26 26 template_name = 'course/index.html'
27   - context_object_name = 'courses_student'
  27 + context_object_name = 'courses'
28 28 paginate_by = 3
29 29  
30 30 def get_context_data(self, **kwargs):
31 31 context = super(IndexView, self).get_context_data(**kwargs)
32 32 context['categories'] = Category.objects.all()
33 33 context['courses_teacher'] = Course.objects.filter(professors__name = self.request.user.name)
  34 + context['courses_student'] = Course.objects.filter(students__name = self.request.user.name)
34 35  
35 36 return context
36 37  
... ...