Django

Code

Changeset 2689

Show
Ignore:
Timestamp:
04/12/06 20:45:15 (3 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/model-api.txt

    r2550 r2689  
    794794    leading "-" will be ordered ascending. Use the string "?" to order randomly. 
    795795 
    796     See `Specifying ordering`_ for a full example. 
     796    For example, to order by a ``pub_date`` field ascending, use this:: 
     797 
     798        ordering = ['pub_date'] 
     799 
     800    To order by ``pub_date`` descending, use this:: 
     801 
     802        ordering = ['-pub_date'] 
     803 
     804    To order by ``pub_date`` descending, then by ``author`` ascending, use this:: 
     805 
     806        ordering = ['-pub_date', 'author'] 
     807 
     808    See `Specifying ordering`_ for more examples. 
    797809 
    798810    .. _Specifying ordering: http://www.djangoproject.com/documentation/models/ordering/