diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-10-15 00:29:27 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-10-15 00:29:27 +0000 |
| commit | 201c15dcb62543ea66ff66858be088340ed50221 (patch) | |
| tree | 3a128b0e7448b2d498a36efd95ef9bd71cb37ba9 /tests | |
| parent | a1d160e2ea22cb010b276cfc2a085f9cd3d81b22 (diff) | |
queryset-refactor: Added an order_by parameter to extra(). Refs #2076.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/queries/models.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index c775772ada..d47792ecaa 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -289,6 +289,11 @@ Bug #2076 >>> Author.objects.order_by('extra', '-name') [<Author: a2>, <Author: a1>, <Author: a4>, <Author: a3>] +# Using remote model default ordering can span multiple models (in this case, +# Cover is ordered by Item's default, which uses Note's default). +>>> Cover.objects.all() +[<Cover: first>, <Cover: second>] + # If the remote model does not have a default ordering, we order by its 'id' # field. >>> Item.objects.order_by('creator', 'name') @@ -300,8 +305,10 @@ Bug #2076 >>> Ranking.objects.all().order_by('rank') [<Ranking: 1: a3>, <Ranking: 2: a2>, <Ranking: 3: a1>] ->>> Cover.objects.all() -[<Cover: first>, <Cover: second>] +# Ordering of extra() pieces is possible, too and you can mix extra fields and +# model fields in the ordering. +>>> Ranking.objects.extra(tables=['django_site'], order_by=['-django_site.id', 'rank']) +[<Ranking: 1: a3>, <Ranking: 2: a2>, <Ranking: 3: a1>] Bugs #2874, #3002 >>> qs = Item.objects.select_related().order_by('note__note', 'name') |
