1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #36404 -- Fixed Aggregate.filter using OuterRef.

Regression in a76035e925.
Thank you to Simon Charette for the review.

co-authored-by: Simon Charette <charette.s@gmail.com>
This commit is contained in:
Adam Johnson
2025-05-21 15:16:12 +01:00
committed by Sarah Boyce
parent d2732c30af
commit b8e5a8a9a2
3 changed files with 25 additions and 6 deletions

View File

@@ -95,7 +95,7 @@ class Aggregate(Func):
raise TypeError(f"{self.__class__.__name__} does not allow default.")
self.distinct = distinct
self.filter = filter and AggregateFilter(filter)
self.filter = None if filter is None else AggregateFilter(filter)
self.default = default
self.order_by = AggregateOrderBy.from_param(
f"{self.__class__.__name__}.order_by", order_by
@@ -120,11 +120,6 @@ class Aggregate(Func):
):
# Aggregates are not allowed in UPDATE queries, so ignore for_save
c = super().resolve_expression(query, allow_joins, reuse, summarize)
c.filter = (
c.filter.resolve_expression(query, allow_joins, reuse, summarize)
if c.filter
else None
)
c.order_by = (
c.order_by.resolve_expression(query, allow_joins, reuse, summarize)
if c.order_by