summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorThomas Chaumeny <t.chaumeny@gmail.com>2014-09-14 12:34:41 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2014-10-28 10:02:10 +0200
commit00aa562884a418c4ee20e223ab82c3455997ee7d (patch)
tree934393c39e5087bad689217003a1de59484e0000 /django/db/models/sql/query.py
parent6b39401bafa955f4891700996aa666349fcdef74 (diff)
Fixed #23493 -- Added bilateral attribute to Transform
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 08af1fb008..b6690e4526 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1111,18 +1111,21 @@ class Query(object):
def build_lookup(self, lookups, lhs, rhs):
lookups = lookups[:]
+ bilaterals = []
while lookups:
lookup = lookups[0]
if len(lookups) == 1:
final_lookup = lhs.get_lookup(lookup)
if final_lookup:
- return final_lookup(lhs, rhs)
+ return final_lookup(lhs, rhs, bilaterals)
# We didn't find a lookup, so we are going to try get_transform
# + get_lookup('exact').
lookups.append('exact')
next = lhs.get_transform(lookup)
if next:
lhs = next(lhs, lookups)
+ if getattr(next, 'bilateral', False):
+ bilaterals.append((next, lookups))
else:
raise FieldError(
"Unsupported lookup '%s' for %s or join on the field not "