django__django-13033
Self referencing foreign key doesn't correctly order by a relation "_id" field.
Verdict: the fix is stated in the issue (Tier A).
if field.is_relation and opts.ordering and getattr(field, 'attname', None) != pieces[-1] and name != 'pk':
The text states the fix: “if field.is_relation and opts.ordering and getattr(field, 'attname', None) != pieces[-1] and name != 'pk':”
All SWE-bench Verified tasks · more django/django tasks · How the check works