latest() doesn't clear previous ordering
|Reported by:||benmoran||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Unlike order_by() in django.db.models.query, the latest() method doesn't clear previous orderings.
This means that latest can return incorrect results if used on a previously sorted QuerySet, e.g.
returns the first rather than the last id.
It looks strange when written on a single line, but can happen - I encountered it with code from django-reversion using QuerySets that already had orderings set.