mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().
Regression in fb3f034f1c.
Thanks Sigurd Ljødal for the report.
This commit is contained in:
@@ -1151,6 +1151,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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user