mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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
This commit is contained in:
@@ -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>]
|
||||
|
||||
"""}
|
||||
|
||||
Reference in New Issue
Block a user