diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html b/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html index 7078834ae..7258c5429 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html @@ -229,4 +229,24 @@

{% trans "No pages have been created." %}{% if parent_page and parent_page_perms.can_add_subpage %} {% blocktrans %}Why not add one?{% endblocktrans %}{% endif %} {% endif %} - \ No newline at end of file + + +{% if parent_page and pages and pages.paginator %} +

+{% endif %} \ No newline at end of file diff --git a/wagtail/wagtailadmin/tests/test_pages_views.py b/wagtail/wagtailadmin/tests/test_pages_views.py index ccaa67dae..14e57a35e 100644 --- a/wagtail/wagtailadmin/tests/test_pages_views.py +++ b/wagtail/wagtailadmin/tests/test_pages_views.py @@ -25,7 +25,7 @@ class TestPageExplorer(TestCase): response = self.client.get(reverse('wagtailadmin_explore', args=(self.root_page.id, ))) self.assertEqual(response.status_code, 200) self.assertEqual(self.root_page, response.context['parent_page']) - self.assertTrue(response.context['pages'].filter(id=self.child_page.id).exists()) + self.assertTrue(response.context['pages'].paginator.object_list.filter(id=self.child_page.id).exists()) class TestPageCreation(TestCase): diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 9bf6dbf44..69e6b7f4f 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -33,6 +33,17 @@ def index(request, parent_page_id=None): else: ordering = 'title' + # Pagination + if ordering != 'ord': + p = request.GET.get('p', 1) + paginator = Paginator(pages, 50) + try: + pages = paginator.page(p) + except PageNotAnInteger: + pages = paginator.page(1) + except EmptyPage: + pages = paginator.page(paginator.num_pages) + return render(request, 'wagtailadmin/pages/index.html', { 'parent_page': parent_page, 'ordering': ordering,