diff options
author | Russell Keith-Magee <russell@keith-magee.com> | 2008-09-01 12:07:26 +0000 |
---|---|---|
committer | Russell Keith-Magee <russell@keith-magee.com> | 2008-09-01 12:07:26 +0000 |
commit | f55b834c2f49a2e07e38a5c8ec7e88a8237ab98e (patch) | |
tree | 9a0d30e8fb736613ad4077c497d9a4cc8c49fb58 /tests/modeltests | |
parent | 823263429ff63701c843aa35edfff1cc7ede3910 (diff) | |
download | django-f55b834c2f49a2e07e38a5c8ec7e88a8237ab98e.tar.gz |
Fixed #7302: Corrected quoting of columns in extra_group_by. Thanks to Ivan Sagalaev for the patch and initial test.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8794 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
-rw-r--r-- | tests/modeltests/ordering/models.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/modeltests/ordering/models.py b/tests/modeltests/ordering/models.py index 94d24b352d..a53d93c330 100644 --- a/tests/modeltests/ordering/models.py +++ b/tests/modeltests/ordering/models.py @@ -77,4 +77,13 @@ __test__ = {'API_TESTS':""" # take the first two). >>> Article.objects.all().reverse()[:2] [<Article: Article 1>, <Article: Article 3>] + +# Ordering can be based on fields included from an 'extra' clause +>>> Article.objects.extra(select={'foo': 'pub_date'}, order_by=['foo', 'headline']) +[<Article: Article 1>, <Article: Article 2>, <Article: Article 3>, <Article: Article 4>] + +# If the extra clause uses an SQL keyword for a name, it will be protected by quoting. +>>> Article.objects.extra(select={'order': 'pub_date'}, order_by=['order', 'headline']) +[<Article: Article 1>, <Article: Article 2>, <Article: Article 3>, <Article: Article 4>] + """} |