diff options
| author | Anssi Kääriäinen <anssi.kaariainen@thl.fi> | 2016-01-20 11:05:48 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-20 19:13:05 -0500 |
| commit | ee596888e1149864e7828f5cf63c0eda395744c3 (patch) | |
| tree | 253a10367482c35c32fa47fa91bdbaaca7987a02 /django/db/models/sql | |
| parent | 2d28144c9519f4e4397c70f045c2b1d31437bf69 (diff) | |
Fixed #26092 -- Fixed QuerySet.order_by() regression with an M2M through model.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 47a85bb9a4..3b804dc0b0 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -555,7 +555,7 @@ class SQLCompiler(object): # If we get to this point and the field is a relation to another model, # append the default ordering for that model unless the attribute name # of the field is specified. - if field.is_relation and path and opts.ordering and name != field.attname: + if field.is_relation and opts.ordering and getattr(field, 'attname', None) != name: # Firstly, avoid infinite loops. if not already_seen: already_seen = set() |
