diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-07-22 18:45:22 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-07-22 18:45:22 +0000 |
| commit | c2a5c49ac279f1e0e2cdbec3de0d957893b9c839 (patch) | |
| tree | 072469cdeab1caa3b040f27a3806bfeb774b53e0 /docs/db-api.txt | |
| parent | c97efb6799168c8903fc1181ecada7fe9932dd1f (diff) | |
Fixed #153 -- Changed docs to use new ordering syntax
git-svn-id: http://code.djangoproject.com/svn/django/trunk@299 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/db-api.txt')
| -rw-r--r-- | docs/db-api.txt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt index f6ca07dd83..401d9d3260 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -107,14 +107,15 @@ provided by the ``order_by`` argument to a lookup:: polls.get_list( pub_date__year=2005, pub_date__month=1, - order_by=(("pub_date", "DESC"), ("question", "ASC")), + order_by=('-pub_date', 'question'), ) -The result set above will be ordered by ``pub_date`` (descending), then -by ``question`` (ascending). Just like in models, the ``order_by`` clause -is a list of ordering tuples where the first element is the field and the -second is "ASC" (ascending) or "DESC" (descending). You can also -use the tuple ``(None, "RANDOM")`` to order the result set randomly. +The result set above will be ordered by ``pub_date`` descending, then +by ``question`` ascending. The negative sign in front of "-pub_date" indicates +descending order. Ascending order is implied. To order randomly, use "?", like +so:: + + polls.get_list(order_by=['?']) Relationships (joins) ===================== |
