mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +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:
parent
823263429f
commit
f55b834c2f
3 changed files with 26 additions and 1 deletions
|
@ -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>]
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue