﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36686	Clarify the behavior difference between order_by() and Meta.ordering in GROUP BY queries	Wouter	Varun Kasyap Pentamaraju	"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."	Cleanup/optimization	closed	Documentation	5.2	Normal	fixed	aggregate, order_by, ordering	Varun Kasyap Pentamaraju	Ready for checkin	1	0	0	0	0	0
