Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 4bcdb15091b21e09a92fe73e26d5ef5cc84bff80 1 parent 00b3891
@adrianholovaty adrianholovaty authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 docs/model-api.txt
View
14 docs/model-api.txt
@@ -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/

0 comments on commit 4bcdb15

Please sign in to comment.
Something went wrong with that request. Please try again.