From f683cb90bea2afbe0ef4c011acd4ab590c37410d Mon Sep 17 00:00:00 2001 From: Klemens Mantzos Date: Thu, 23 Jan 2014 03:13:59 +0100 Subject: Fixed #21924 -- Added the ability to specify a reverse order for admin_order_field. Thanks Klemens Mantzos for the report and initial patch. --- docs/ref/contrib/admin/index.txt | 8 ++++++++ docs/releases/1.7.txt | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 28de1aa612..e44ecc8e55 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -664,6 +664,14 @@ subclass:: The above will tell Django to order by the ``first_name`` field when trying to sort by ``colored_first_name`` in the admin. + .. versionadded:: 1.7 + + To indicate descending order with ``admin_model_field`` you can use a + hyphen prefix on the field name. Using the above example, this would + look like:: + + colored_first_name.admin_order_field = '-first_name' + * Elements of ``list_display`` can also be properties. Please note however, that due to the way properties work in Python, setting ``short_description`` on a property is only possible when using the diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index d2f1c39ec3..8e9ebe72a1 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -292,6 +292,10 @@ Minor features ` to control whether or not to display the "View on site" link. +* You can specify a descending ordering for a :attr:`ModelAdmin.list_display + ` value by prefixing the + ``admin_order_field`` value with a hyphen. + :mod:`django.contrib.auth` ^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.3