Fixed #15624 -- Made sure aggregations are present in SELECT

This commit is contained in:
Florian Hahn 2013-02-19 22:58:09 +01:00 committed by Anssi Kääriäinen
parent e01b5a5823
commit e888a9b30d
3 changed files with 10 additions and 1 deletions

View file

@ -250,6 +250,13 @@ class AggregationTests(TestCase):
'price__max': Decimal("82.80")
})
# Regression for #15624 - Missing SELECT columns when using values, annotate
# and aggregate in a single query
self.assertEqual(
Book.objects.annotate(c=Count('authors')).values('c').aggregate(Max('c')),
{'c__max': 3}
)
def test_field_error(self):
# Bad field requests in aggregates are caught and reported
self.assertRaises(