diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-29 10:46:36 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-29 10:46:36 +0000 |
| commit | cf37e4624a967f936ecbb5a4eefc9d38ed9d7892 (patch) | |
| tree | e44fab9a21ccdf130d85b6fb80c423181663f103 /django/db/models/sql/where.py | |
| parent | 08dd4176edc1019d9168608b55fe777512c641cb (diff) | |
Fixed #7210 -- Added F() expressions to query language. See the documentation for details on usage.
Many thanks to:
* Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
* Alex Gaynor for his help debugging and fixing a number of issues.
* Malcolm Tredinnick for his invaluable review notes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9792 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 9ce1e7bf2d..8724906a8c 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -97,6 +97,7 @@ class WhereNode(tree.Node): else: # A leaf node in the tree. sql, params = self.make_atom(child, qn) + except EmptyResultSet: if self.connector == AND and not self.negated: # We can bail out early in this particular case (only). @@ -114,6 +115,7 @@ class WhereNode(tree.Node): if self.negated: empty = True continue + empty = False if sql: result.append(sql) @@ -151,8 +153,9 @@ class WhereNode(tree.Node): else: cast_sql = '%s' - if isinstance(params, QueryWrapper): - extra, params = params.data + if hasattr(params, 'as_sql'): + extra, params = params.as_sql(qn) + cast_sql = '' else: extra = '' @@ -214,6 +217,9 @@ class WhereNode(tree.Node): if elt[0] in change_map: elt[0] = change_map[elt[0]] node.children[pos] = (tuple(elt),) + child[1:] + # Check if the query value also requires relabelling + if hasattr(child[3], 'relabel_aliases'): + child[3].relabel_aliases(change_map) class EverythingNode(object): """ |
