0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Added some examples to 'ordering' section of docs/model-api.txt

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-04-13 01:45:15 +00:00
parent 00b3891524
commit 4bcdb15091

View File

@ -793,7 +793,19 @@ Here's a list of all possible ``META`` options. No options are required. Adding
optional "-" prefix, which indicates descending order. Fields without a
leading "-" will be ordered ascending. Use the string "?" to order randomly.
See `Specifying ordering`_ for a full example.
For example, to order by a ``pub_date`` field ascending, use this::
ordering = ['pub_date']
To order by ``pub_date`` descending, use this::
ordering = ['-pub_date']
To order by ``pub_date`` descending, then by ``author`` ascending, use this::
ordering = ['-pub_date', 'author']
See `Specifying ordering`_ for more examples.
.. _Specifying ordering: http://www.djangoproject.com/documentation/models/ordering/