|
|
|
@ -141,6 +141,11 @@ class CourseView(DetailView): |
|
|
|
context_object_name = 'course' |
|
|
|
context_object_name = 'course' |
|
|
|
template_name = 'course/course.html' |
|
|
|
template_name = 'course/course.html' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
|
|
|
|
context['next'] = self.request.GET.get('next', None) |
|
|
|
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CoursesView(ListView): |
|
|
|
class CoursesView(ListView): |
|
|
|
model = Course |
|
|
|
model = Course |
|
|
|
@ -207,9 +212,11 @@ class SearchView(CoursesView): |
|
|
|
queryset = queryset.none() |
|
|
|
queryset = queryset.none() |
|
|
|
return queryset |
|
|
|
return queryset |
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self): |
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
context = super().get_context_data() |
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
context['q'] = self.request.GET.get('q', None) or '' |
|
|
|
context['q'] = self.request.GET.get('q', None) or '' |
|
|
|
|
|
|
|
context['next'] = self.request.GET.get('next', None) |
|
|
|
|
|
|
|
return context |
|
|
|
if 'is_paginated' in context and context['is_paginated']: |
|
|
|
if 'is_paginated' in context and context['is_paginated']: |
|
|
|
page_obj = context.get('page_obj') |
|
|
|
page_obj = context.get('page_obj') |
|
|
|
context['page'] = page_obj.number |
|
|
|
context['page'] = page_obj.number |
|
|
|
|