From 97e815903e0d7cc7356b362308dba7ab35c92b52 Mon Sep 17 00:00:00 2001 From: Dave Cranwell Date: Fri, 27 Jun 2014 11:49:55 +0100 Subject: [PATCH] replacing lines from another botched merge --- wagtail/wagtailadmin/views/pages.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 5f722edcae..3516e6e75c 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: @@ -181,6 +179,7 @@ def create(request, content_type_app_name, content_type_model_name, parent_page_ 'parent_page': parent_page, 'edit_handler': edit_handler, 'display_modes': page.get_page_modes(), + 'form': form, # Used in unit tests }) @@ -266,6 +265,7 @@ def edit(request, page_id): 'edit_handler': edit_handler, 'errors_debug': errors_debug, 'display_modes': page.get_page_modes(), + 'form': form, # Used in unit tests })