1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #30798 -- Prevented chaining fields from the same related model multiple times in model Meta.ordering.

This commit is contained in:
Hasan Ramezani
2019-09-26 10:33:54 +02:00
committed by Mariusz Felisiak
parent c2678e4975
commit c7944628a1
2 changed files with 22 additions and 0 deletions

View File

@@ -1711,6 +1711,8 @@ class Model(metaclass=ModelBase):
fld = _cls._meta.get_field(part)
if fld.is_relation:
_cls = fld.get_path_info()[-1].to_opts.model
else:
_cls = None
except (FieldDoesNotExist, AttributeError):
if fld is None or fld.get_transform(part) is None:
errors.append(