Commit f946b6597f839b011521bb82c8e3e5cd040e2235

Authored by Zambom
1 parent 068cbc59

Adding pagination in manage categories

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