mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #34975 -- Fixed crash of conditional aggregate() over aggregations.
Adjustments made to solve_lookup_type to defer the resolving of
references for summarized aggregates failed to account for similar
requirements for lookup values which can also reference annotations
through Aggregate.filter.
Regression in b181cae2e3.
Refs #25307.
Thanks Sergey Nesterenko for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
594873befb
commit
7530cf3900
@@ -2309,3 +2309,9 @@ class AggregateAnnotationPruningTests(TestCase):
|
||||
aggregate,
|
||||
{"sum_avg_publisher_pages": 1100.0, "books_count": 2},
|
||||
)
|
||||
|
||||
def test_aggregate_reference_lookup_rhs(self):
|
||||
aggregates = Author.objects.annotate(
|
||||
max_book_author=Max("book__authors"),
|
||||
).aggregate(count=Count("id", filter=Q(id=F("max_book_author"))))
|
||||
self.assertEqual(aggregates, {"count": 1})
|
||||
|
||||
Reference in New Issue
Block a user