Hi Chris,
Ah yes, you're right - modifying the native tree ordering (as done by page.move(parent, 'first-child') ) is of limited usefulness, given that you have to specifically switch to ordering=ord to see it...
The default page ordering in the explorer is set to latest_revision_created_at descending (i.e. most recently edited first):
https://github.com/torchbox/wagtail/blob/51b4f0f53d93a69f3beaba67e3211cd001ff4087/wagtail/wagtailadmin/views/pages.py#L48
We didn't design that with overriding in mind (that's waiting on
https://github.com/torchbox/wagtail/issues/882), but I think it might be possible to make it work with the construct_explorer_page_queryset hook <
http://docs.wagtail.io/en/v1.7/reference/hooks.html#construct-explorer-page-queryset> - something like:
@hooks.register('construct_explorer_page_queryset')
def apply_default_order_to_news_section(parent_page, pages, request):
if parent_page.slug == 'news' and 'ordering' not in request.GET:
# this is the news section, and the user has not chosen a specific ordering
pages = pages.order_by('first_published_at')
# note that if the field you want to order on is specific to NewsPage,
# you'll need to hack things a bit more to retrieve that:
# pages = NewsPage.objects.child_of(parent_page).order_by('post_date')
return pages
Cheers,
- Matt