summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-06-21 16:11:17 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-06-21 16:11:17 +0000
commit706b18966f7f6dcef715ca7b5230e72147cefda6 (patch)
treeb71751270c449ab0dcfe9123c7eb91e4a770a373 /django/db/models/sql/query.py
parentdd5e71829627705d68905d91fc18c3554a9c69c8 (diff)
[soc2010/query-refactor] Cleaned up implementation of negation in MongoDB, and no longer rely on a feature from MongoDB unstable version.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13368 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 959990f628..6836337429 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1077,7 +1077,11 @@ class Query(object):
# it's short-circuited in the Where class.
# We also need to handle the case where a subquery is provided
entry = self.where_class()
- entry.add((Constraint(alias, col, None), 'isnull', True), AND)
+ entry.add((
+ Constraint(alias, col, None, eliminatable_if=lambda connection: not getattr(connection.features, "sql_nulls", True)),
+ 'isnull',
+ True
+ ), AND)
entry.negate()
self.where.add(entry, AND)