diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-04 20:49:11 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-04 20:49:43 +0100 |
| commit | 4f81f6d2364f00262f4577fc1de4e0a6ff424e89 (patch) | |
| tree | ce57aad1838cd1dd2ada543b9d5b4a2ce55a5e5f /tests/aggregation | |
| parent | 02cda09b13e677db01863fa0a7112dba631b9c5c (diff) | |
[3.0.x] Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().
Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.
Thanks Sigurd Ljødal for the report.
Backport of 0f843fdd5b9b2f2307148465cd60f4e1b2befbb4 from master
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index efc0a72c86..2cabeb5df8 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1149,6 +1149,20 @@ class AggregateTestCase(TestCase): ) self.assertTrue(publisher_qs.exists()) + def test_aggregation_exists_annotation(self): + published_books = Book.objects.filter(publisher=OuterRef('pk')) + publisher_qs = Publisher.objects.annotate( + published_book=Exists(published_books), + count=Count('book'), + ).values_list('name', flat=True) + self.assertCountEqual(list(publisher_qs), [ + 'Apress', + 'Morgan Kaufmann', + "Jonno's House of Books", + 'Prentice Hall', + 'Sams', + ]) + @skipUnlessDBFeature('supports_subqueries_in_group_by') def test_group_by_subquery_annotation(self): """ |
