diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-04-13 01:45:15 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-04-13 01:45:15 +0000 |
| commit | 4bcdb15091b21e09a92fe73e26d5ef5cc84bff80 (patch) | |
| tree | 1fbbd64126158acc93e9ea7e497b900731574112 /docs/model-api.txt | |
| parent | 00b3891524643d0febd2f54a01021c46c103a520 (diff) | |
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
Diffstat (limited to 'docs/model-api.txt')
| -rw-r--r-- | docs/model-api.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt index ecd813b17d..ec5b5e5ad4 100644 --- a/docs/model-api.txt +++ b/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/ |
