1
0
mirror of https://github.com/django/django.git synced 2025-10-30 00:56:09 +00:00

[2.0.x] Fixed #29067 -- Fixed regression in QuerySet.values_list(..., flat=True) followed by annotate().

Regression in 4dfd6b88d5.

Backport of 3187c89d6f from master
This commit is contained in:
Jon Dufresne
2018-01-25 20:28:34 -08:00
committed by Tim Graham
parent d06381debc
commit 61c74ae74f
3 changed files with 10 additions and 2 deletions

View File

@@ -1475,6 +1475,11 @@ class AggregationTests(TestCase):
vals2 = Book.objects.aggregate(result=Sum('rating') - Value(4.0))
self.assertEqual(vals1, vals2)
def test_annotate_values_list_flat(self):
"""Find ages that are shared by at least two authors."""
qs = Author.objects.values_list('age', flat=True).annotate(age_count=Count('age')).filter(age_count__gt=1)
self.assertSequenceEqual(qs, [29])
class JoinPromotionTests(TestCase):
def test_ticket_21150(self):