diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html b/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html index 1a4929228..13899c70f 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html @@ -10,6 +10,7 @@ {% endif %} + {% if moving or choosing %} @@ -21,6 +22,7 @@ {% if show_parent %} {% trans 'Parent' %} {% endif %} + {% trans 'Updated' %} {% trans 'Type' %} {% trans 'Status' %} @@ -96,6 +98,7 @@ {% endif %} +
{{ parent_page.latest_revision_created_at|timesince }}
{{ parent_page.content_type.model_class.get_verbose_name }} {% if not choosing and not moving and parent_page.live and not parent_page.is_root and 'view_live' not in hide_actions|default:'' %} @@ -129,8 +132,17 @@ {% endif %} {% if show_parent %} - Parent + {% trans 'Parent' %} {% endif %} + + {% if sortable %} + + {% trans 'Updated' %} + + {% else %} + {% trans 'Updated' %} + {% endif %} + {% if sortable %} @@ -230,6 +242,7 @@ {% endwith %} {% endif %} +
{{ page.latest_revision_created_at|timesince }}
{{ page.content_type.model_class.get_verbose_name }} {% if not choosing and not moving and page.live and 'view_live' not in hide_actions|default:'' %} diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 9fd1c7186..d0f7f7d29 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -12,6 +12,7 @@ from django.utils.translation import ugettext as _ from django.utils.http import is_safe_url from django.views.decorators.http import require_GET, require_POST from django.views.decorators.vary import vary_on_headers +from django.db.models import Count from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList from wagtail.wagtailadmin.forms import SearchForm, CopyForm @@ -38,13 +39,16 @@ def index(request, parent_page_id=None): pages = parent_page.get_children().prefetch_related('content_type') # Get page ordering - ordering = request.GET.get('ordering', 'title') - if ordering not in ['title', '-title', 'content_type', '-content_type', 'live', '-live', 'ord']: - ordering = 'title' + ordering = request.GET.get('ordering', '-latest_revision_created_at') + if ordering not in ['title', '-title', 'content_type', '-content_type', 'live', '-live', 'latest_revision_created_at', '-latest_revision_created_at', 'ord']: + ordering = '-latest_revision_created_at' # Pagination if ordering != 'ord': - pages = pages.order_by(ordering) + ordering_no_minus = ordering + if ordering_no_minus.startswith('-'): + ordering_no_minus = ordering[1:] + pages = pages.order_by(ordering).annotate(null_position=Count(ordering_no_minus)).order_by('-null_position', ordering) p = request.GET.get('p', 1) paginator = Paginator(pages, 50)