summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorIan Foote <python@ian.feete.org>2015-10-25 23:29:34 +0000
committerTim Graham <timograham@gmail.com>2015-10-27 13:57:52 -0400
commit32e804cdb7e09c260fa1f224962831d2b672af85 (patch)
tree77dcfca870d443ce86550d37786fa7dfcbeb9611 /django/db/models/sql
parentda9e9484f2407ea5f2309ba1899fc93c58d206e3 (diff)
[1.9.x] Fixed #25609 -- Fixed regression in related field nested lookup error.
Backport of 32ef48aa562e6aaee9983f5d0f1c60f02fd555fb from master
Diffstat (limited to 'django/db/models/sql')
-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 9dd666040f..4f5f7aad68 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1187,7 +1187,10 @@ class Query(object):
if field.is_relation:
# No support for transforms for relational fields
- assert len(lookups) == 1
+ num_lookups = len(lookups)
+ if num_lookups > 1:
+ raise FieldError('Related Field got invalid lookup: {}'.format(lookups[0]))
+ assert num_lookups > 0 # Likely a bug in Django if this fails.
lookup_class = field.get_lookup(lookups[0])
if len(targets) == 1:
lhs = targets[0].get_col(alias, field)