summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-14 02:16:08 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-14 02:16:08 +0000
commitcae24af822cabba1ca35bf95150220f7aa8aca24 (patch)
tree9710e8be8e964301ae13cf3cf18e1dd6b8cfb0c0
parent240ecf0811b6ab53d0a2914dc92c5b1cd3b01551 (diff)
queryset-refactor: Previous exclude() fixing broke the simple case. Fixed that
(the lookup tests picked this up). git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/sql/query.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index ff0da5e6e2..9f4edff7cf 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -570,11 +570,10 @@ class Query(object):
if name == 'pk':
name = target_field.name
if joins is not None:
+ if null_point is None and nullable:
+ null_point = len(join_list)
join_list.append(joins)
- last = joins
alias = joins[-1]
- if not null_point and nullable:
- null_point = len(join_list)
if connection == OR and not split:
# FIXME: Document what's going on and why this is needed.
if self.alias_map[joins[0]][ALIAS_REFCOUNT] == 1:
@@ -616,12 +615,15 @@ class Query(object):
self.where.add([alias, col, orig_field, lookup_type, value],
connection)
- if negate and null_point:
- if join_list:
- for join in last:
- self.promote_alias(join)
- self.where.negate()
- self.where.add([alias, col, orig_field, 'isnull', True], OR)
+ if negate:
+ if join_list and null_point is not None:
+ for elt in join_list[null_point:]:
+ for join in elt:
+ self.promote_alias(join)
+ self.where.negate()
+ self.where.add([alias, col, orig_field, 'isnull', True], OR)
+ else:
+ self.where.negate()
def add_q(self, q_object):
"""