Fixed #24705 -- Fixed negated Q objects in expressions.

Avoided split_exclude() for Q when used as an expression.
This commit is contained in:
Anssi Kääriäinen 2015-05-19 14:49:00 +03:00 committed by Tim Graham
parent 8b106cfaa0
commit bc87061a3c
4 changed files with 54 additions and 6 deletions

View file

@ -90,7 +90,7 @@ class Q(tree.Node):
# 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)
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)
return clause