mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
[1.8.x] Fixed #24924 -- Join promotion for multiple Case expressions
Backport of 541f4ea546 from master
This commit is contained in:
@@ -87,10 +87,8 @@ class Q(tree.Node):
|
||||
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
|
||||
# We must promote any new joins to left outer joins so that when Q is
|
||||
# used as an expression, rows aren't filtered due to joins.
|
||||
joins_before = query.tables[:]
|
||||
clause, joins = query._add_q(self, reuse, allow_joins=allow_joins, split_subq=False)
|
||||
joins_to_promote = [j for j in joins if j not in joins_before]
|
||||
query.promote_joins(joins_to_promote)
|
||||
query.promote_joins(joins)
|
||||
return clause
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user