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 })