mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #30739 -- Fixed exclusion of multi-valued lookup against outer rhs.
OuterRef right hand sides have to be nested, just like F rhs have to, during the subquery pushdown split_exclude performs to ensure they are resolved against the outer query aliases.
This commit is contained in:
committed by
Mariusz Felisiak
parent
600628f8f0
commit
13a8884a08
@@ -1702,7 +1702,9 @@ class Query(BaseExpression):
|
||||
handle.
|
||||
"""
|
||||
filter_lhs, filter_rhs = filter_expr
|
||||
if isinstance(filter_rhs, F):
|
||||
if isinstance(filter_rhs, OuterRef):
|
||||
filter_expr = (filter_lhs, OuterRef(filter_rhs))
|
||||
elif isinstance(filter_rhs, F):
|
||||
filter_expr = (filter_lhs, OuterRef(filter_rhs.name))
|
||||
# Generate the inner query.
|
||||
query = Query(self.model)
|
||||
|
||||
Reference in New Issue
Block a user