From b480c9e7eb9a88d99402ced8b5535b51d2f78f17 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Tue, 17 Jun 2014 17:25:49 +0100 Subject: [PATCH] Fixes to wagtailadmin page index view --- wagtail/wagtailadmin/views/pages.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 69e6b7f4f4..7efe553ceb 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -25,16 +25,14 @@ def index(request, parent_page_id=None): pages = parent_page.get_children().prefetch_related('content_type') # Get page ordering - if 'ordering' in request.GET: - ordering = request.GET['ordering'] - - if ordering in ['title', '-title', 'content_type', '-content_type', 'live', '-live']: - pages = pages.order_by(ordering) - else: + ordering = request.GET.get('ordering', 'title') + if ordering not in ['title', '-title', 'content_type', '-content_type', 'live', '-live', 'ord']: ordering = 'title' # Pagination if ordering != 'ord': + pages = pages.order_by(ordering) + p = request.GET.get('p', 1) paginator = Paginator(pages, 50) try: