#36686: Update documentation on 'never removes' ordering.
-----------------------+-----------------------------------------
Reporter: wutje | Type: Bug
Status: new | Component: Documentation
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------+-----------------------------------------
Today I hunted an ordering bug. I have a model with {{{ordering =
['name']}}}
And in a view I use:
{{{queryset.annotate(used_by=Count('somerelation'))}}} which drops the
order_by.
However the documentation for a aggregation states:
https://docs.djangoproject.com/en/5.2/topics/db/aggregation/ that:
{{{Django never removes ordering constraints that you have specified}}}.
But then I saw the changelog for version. 2.2. Which explicitly states:
{{{A model’s Meta.ordering affecting GROUP BY queries (such as
.annotate().values()) is a common source of confusion. Such queries now
issue a deprecation warning with the advice to add an order_by() to retain
the current query. Meta.ordering will be ignored in such queries starting
in Django 3.1.}}}
Where do I find this information in the current documentation? I think
this information is currently missing.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36686>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.