Commit f946b6597f839b011521bb82c8e3e5cd040e2235

Authored by Zambom
1 parent 068cbc59

Adding pagination in manage categories

categories/templates/categories/list.html
1 1 {% extends 'categories/home.html' %}
2 2  
3   -{% load static i18n permission_tags %}
  3 +{% load static i18n pagination %}
4 4 {% load django_bootstrap_breadcrumbs %}
5 5  
6 6 {% block javascript%}
... ... @@ -169,6 +169,7 @@
169 169 </div>
170 170 {% endif %}
171 171 {% endfor %}
  172 + {% pagination request paginator page_obj %}
172 173 </div>
173 174 </div>
174 175 <div id="modal_course">
... ...
categories/views.py
... ... @@ -31,11 +31,11 @@ class IndexView(views.SuperuserRequiredMixin, LoginRequiredMixin, ListView):
31 31 queryset = Category.objects.all()
32 32 template_name = 'categories/list.html'
33 33 context_object_name = 'categories'
  34 + paginate_by = 10
34 35  
35 36 def get_queryset(self):
36 37 result = super(IndexView, self).get_queryset()
37 38  
38   -
39 39 return result
40 40  
41 41 def render_to_response(self, context, **response_kwargs):
... ...
subjects/templates/subjects/list.html
1 1 {% extends 'categories/home.html' %}
2 2  
3   -{% load static i18n permission_tags pagination %}
  3 +{% load static i18n pagination %}
4 4 {% load django_bootstrap_breadcrumbs %}
5 5  
6 6 {% block javascript%}
... ...
subjects/views.py
... ... @@ -69,7 +69,7 @@ class IndexView(LoginRequiredMixin, ListView):
69 69 queryset = Category.objects.all()
70 70 template_name = 'subjects/list.html'
71 71 context_object_name = 'categories'
72   - paginate_by = 5
  72 + paginate_by = 10
73 73  
74 74 def get_queryset(self):
75 75 categories = Category.objects.all().order_by('name')
... ...