summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2011-05-07 19:02:51 +0000
committerLuke Plant <L.Plant.98@cantab.net>2011-05-07 19:02:51 +0000
commit385ae343fbd2355a09ba0f459445bf04406db60b (patch)
tree4a64edfe731519e07218693a70a0a746f47e86b6 /tests
parent32bd953e632ffaf6c1d4f8514600986e729ecb66 (diff)
Fixed #15709 - Duplicated group_by condition
Thanks to ziangsong for report, and to mk for the patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@16180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/aggregation_regress/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py
index 0bb68991ea..14104210af 100644
--- a/tests/regressiontests/aggregation_regress/tests.py
+++ b/tests/regressiontests/aggregation_regress/tests.py
@@ -462,6 +462,12 @@ class AggregationTests(TestCase):
lambda b: b.name
)
+ # Regression for #15709 - Ensure each group_by field only exists once
+ # per query
+ qs = Book.objects.values('publisher').annotate(max_pages=Max('pages')).order_by()
+ grouping, gb_params = qs.query.get_compiler(qs.db).get_grouping()
+ self.assertEqual(len(grouping), 1)
+
def test_duplicate_alias(self):
# Regression for #11256 - duplicating a default alias raises ValueError.
self.assertRaises(ValueError, Book.objects.all().annotate, Avg('authors__age'), authors__age__avg=Avg('authors__age'))