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