1
0
mirror of https://github.com/django/django.git synced 2025-07-06 18:59:13 +00:00

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
This commit is contained in:
Malcolm Tredinnick 2007-10-14 02:16:08 +00:00
parent 240ecf0811
commit cae24af822

View File

@ -570,11 +570,10 @@ class Query(object):
if name == 'pk': if name == 'pk':
name = target_field.name name = target_field.name
if joins is not None: if joins is not None:
join_list.append(joins) if null_point is None and nullable:
last = joins
alias = joins[-1]
if not null_point and nullable:
null_point = len(join_list) null_point = len(join_list)
join_list.append(joins)
alias = joins[-1]
if connection == OR and not split: if connection == OR and not split:
# FIXME: Document what's going on and why this is needed. # FIXME: Document what's going on and why this is needed.
if self.alias_map[joins[0]][ALIAS_REFCOUNT] == 1: 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], self.where.add([alias, col, orig_field, lookup_type, value],
connection) connection)
if negate and null_point: if negate:
if join_list: if join_list and null_point is not None:
for join in last: for elt in join_list[null_point:]:
self.promote_alias(join) for join in elt:
self.where.negate() self.promote_alias(join)
self.where.add([alias, col, orig_field, 'isnull', True], OR) self.where.negate()
self.where.add([alias, col, orig_field, 'isnull', True], OR)
else:
self.where.negate()
def add_q(self, q_object): def add_q(self, q_object):
""" """