diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-24 06:53:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-24 06:53:54 +0000 |
| commit | 15b1675af988d2918b142e8a0c2ab6fcf50e4649 (patch) | |
| tree | bb07df8b706680c0cb2e721c6398a75ccfa68600 /tests/regressiontests/aggregation_regress | |
| parent | f5ed27cf1f26a678869d91cbbfca24dc53e603e5 (diff) | |
Fixed #10113 -- Ensured that joined fields mentioned in order_by() are included in the GROUP_BY clause on those backends that require it. Thanks to Koen Biermans <koen.biermans@werk.belgie.be> for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9788 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/aggregation_regress')
| -rw-r--r-- | tests/regressiontests/aggregation_regress/models.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py index 7ff54b2c0d..f41d9a252b 100644 --- a/tests/regressiontests/aggregation_regress/models.py +++ b/tests/regressiontests/aggregation_regress/models.py @@ -174,6 +174,11 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, id, i >>> Publisher.objects.filter(pk=5).annotate(num_authors=Count('book__authors'), avg_authors=Avg('book__authors'), max_authors=Max('book__authors'), max_price=Max('book__price'), max_rating=Max('book__rating')).values() [{'max_authors': None, 'name': u"Jonno's House of Books", 'num_awards': 0, 'max_price': None, 'num_authors': 0, 'max_rating': None, 'id': 5, 'avg_authors': None}] +# Regression for #10113 - Fields mentioned in order_by() must be included in the GROUP BY. +# This only becomes a problem when the order_by introduces a new join. +>>> Book.objects.annotate(num_authors=Count('authors')).order_by('publisher__name') +[<Book: The Definitive Guide to Django: Web Development Done Right>, <Book: Practical Django Projects>, <Book: Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp>, <Book: Python Web Development with Django>, <Book: Artificial Intelligence: A Modern Approach>, <Book: Sams Teach Yourself Django in 24 Hours>] + """ } |
