mirror of
https://github.com/django/django.git
synced 2025-12-01 07:48:28 +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:
parent
225c413b08
commit
bb6b9aa472
3 changed files with 53 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue