From 30df8890c25741c6be6c52fe9a09858e5a4fe7de Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 28 Oct 2018 07:49:04 +0100
Subject: [PATCH] Include pagination in Topic list

---
 ontology/templates/ontology/topic_list.html | 8 ++++++++
 ontology/views.py                           | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ontology/templates/ontology/topic_list.html b/ontology/templates/ontology/topic_list.html
index f0f869dba..b61a206ab 100644
--- a/ontology/templates/ontology/topic_list.html
+++ b/ontology/templates/ontology/topic_list.html
@@ -28,6 +28,14 @@
       <li><a href="{% url 'ontology:topic_details' slug=topic.slug %}">{{ topic }}</a></li>
       {% endfor %}
     </ul>
+
+
+    {% if is_paginated %}
+    <div class="col-12">
+      {% include 'partials/pagination.html' with page_obj=page_obj %}
+    </div>
+    {% endif %}
+
   </div>
 </div>
 
diff --git a/ontology/views.py b/ontology/views.py
index c88db65aa..1dc5b8673 100644
--- a/ontology/views.py
+++ b/ontology/views.py
@@ -12,7 +12,7 @@ from django.views.generic.list import ListView
 
 from .models import Topic, RelationAsym, RelationSym
 
-from scipost.mixins import PermissionsMixin
+from scipost.mixins import PaginationMixin, PermissionsMixin
 
 
 def ontology(request):
@@ -41,8 +41,9 @@ class TopicUpdateView(PermissionsMixin, UpdateView):
     success_url = reverse_lazy('ontology:topics')
 
 
-class TopicListView(ListView):
+class TopicListView(PaginationMixin, ListView):
     model = Topic
+    paginate_by = 25
 
 
 class TopicDetailView(DetailView):
-- 
GitLab