diff options
| author | Ian Foote <python@ian.feete.org> | 2015-10-25 23:29:34 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-27 13:49:00 -0400 |
| commit | 32ef48aa562e6aaee9983f5d0f1c60f02fd555fb (patch) | |
| tree | 8b3b136b8eb7745d3ca431dd0a0cd59a96ba76bf /django/db/models/sql | |
| parent | 976bd519a879b2fd7a356cb21bde32696adb545f (diff) | |
Fixed #25609 -- Fixed regression in related field nested lookup error.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index cb1696dd62..0686bf8875 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1172,7 +1172,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) |
