From edec3e59a33ae4f456194c29630fd601213eee2f Mon Sep 17 00:00:00 2001 From: Kasyap Pentamaraju Date: Sat, 25 Oct 2025 19:23:40 +0530 Subject: [5.2.x] Fixed #36686 -- Clarified Meta.ordering is ignored in GROUP BY queries. Backport of 7e765a68598b2b798e49bf1f4b431a7bcac085a4 from main. --- docs/ref/models/options.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index 3433d0730f..62064d4f24 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -309,6 +309,12 @@ not be looking at your Django code. For example:: ordering = [F("author").asc(nulls_last=True)] +.. admonition:: Default ordering and GROUP BY + + In :ref:`GROUP BY queries ` (for example, + those using :meth:`~.QuerySet.values` and :meth:`~.QuerySet.annotate`), the + default ordering is not applied. + .. warning:: Ordering is not a free operation. Each field you add to the ordering -- cgit v1.3