Author: mtredinnick
Date: 2007-10-13 21:16:08 -0500 (Sat, 13 Oct 2007)
New Revision: 6496
Modified:
django/branches/queryset-refactor/django/db/models/sql/query.py
Log:
queryset-refactor: Previous exclude() fixing broke the simple case. Fixed that
(the lookup tests picked this up).
Modified: django/branches/queryset-refactor/django/db/models/sql/query.py
===================================================================
--- django/branches/queryset-refactor/django/db/models/sql/query.py
2007-10-14 02:15:52 UTC (rev 6495)
+++ django/branches/queryset-refactor/django/db/models/sql/query.py
2007-10-14 02:16:08 UTC (rev 6496)
@@ -570,11 +570,10 @@
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 @@
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):
"""
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---