Commit 3bef809f0e35986ac0cafba0891c0ed0fa750e54
1 parent
1454431b
Exists in
master
and in
3 other branches
Fixing categories pagination
Showing
1 changed file
with
3 additions
and
5 deletions
Show diff stats
categories/views.py
... | ... | @@ -28,15 +28,15 @@ class IndexView(views.SuperuserRequiredMixin, LoginRequiredMixin, ListView): |
28 | 28 | |
29 | 29 | login_url = reverse_lazy("users:login") |
30 | 30 | redirect_field_name = 'next' |
31 | - queryset = Category.objects.all() | |
31 | + model = Category | |
32 | 32 | template_name = 'categories/list.html' |
33 | 33 | context_object_name = 'categories' |
34 | 34 | paginate_by = 10 |
35 | 35 | |
36 | 36 | def get_queryset(self): |
37 | - result = super(IndexView, self).get_queryset() | |
37 | + categories = Category.objects.all().order_by('name') | |
38 | 38 | |
39 | - return result | |
39 | + return categories | |
40 | 40 | |
41 | 41 | def render_to_response(self, context, **response_kwargs): |
42 | 42 | if self.request.user.is_staff: |
... | ... | @@ -57,8 +57,6 @@ class IndexView(views.SuperuserRequiredMixin, LoginRequiredMixin, ListView): |
57 | 57 | def get_context_data(self, **kwargs): |
58 | 58 | context = super(IndexView, self).get_context_data(**kwargs) |
59 | 59 | |
60 | - categories = self.get_queryset().order_by('name') | |
61 | - context['categories'] = categories | |
62 | 60 | context['settings_menu_active'] = "settings_menu_active" |
63 | 61 | |
64 | 62 | return context | ... | ... |