#27536: order_by('pk') is not obeyed if superclass has default ordering
-------------------------------------+-------------------------------------
Reporter: Andrew Dodd | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: order_by ordering | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
I agree with you that It's definitely an unexpected result, just like the
whole ordering by a foreign key orders by the referenced model's ordering
feature is.
However changing this now would most likely break a lot of code without
offering an alternative solution for the actual supporter of the feature.
I personally think special casing the MTI `pk` case would make it even
worse as that would be another rule to be aware of. Think of what should
be done in regard to models using a foreign key as a primary key without
relying on MTI?
I wouldn't be opposed to such a change as I've been affected by this issue
myself in past. That's what motivated me to work on allowing ordering by
`_id` fields to bypass this behavior in #19195 but I'd suggest you take
this discussion to the mailing list to gather some support and feedback if
you're interested in working toward removing this feature.
--
Ticket URL: <https://code.djangoproject.com/ticket/27536#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.fc0d0702d153839deb63216e1171fc92%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.