mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
Fixed #11535: Corrected SQL generated for queries involving generic relations and ORed Q objects. Thanks to brianglass for report, tobias for fix and test, and Alex for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12405 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1100,13 +1100,13 @@ class Query(object):
|
||||
for child in q_object.children:
|
||||
if connector == OR:
|
||||
refcounts_before = self.alias_refcount.copy()
|
||||
self.where.start_subtree(connector)
|
||||
if isinstance(child, Node):
|
||||
self.where.start_subtree(connector)
|
||||
self.add_q(child, used_aliases)
|
||||
self.where.end_subtree()
|
||||
else:
|
||||
self.add_filter(child, connector, q_object.negated,
|
||||
can_reuse=used_aliases)
|
||||
self.where.end_subtree()
|
||||
if connector == OR:
|
||||
# Aliases that were newly added or not used at all need to
|
||||
# be promoted to outer joins if they are nullable relations.
|
||||
|
||||
Reference in New Issue
Block a user