mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #14357 -- Made Meta.ordering not affect GROUP BY queries.
Per deprecation timeline.
This commit is contained in:
@@ -284,10 +284,6 @@ Django quotes column and table names behind the scenes.
|
||||
|
||||
ordering = [F('author').asc(nulls_last=True)]
|
||||
|
||||
Default ordering also affects :ref:`aggregation queries
|
||||
<aggregation-ordering-interaction>` but this won't be the case starting
|
||||
in Django 3.1.
|
||||
|
||||
.. warning::
|
||||
|
||||
Ordering is not a free operation. Each field you add to the ordering
|
||||
|
||||
@@ -234,6 +234,8 @@ to remove usage of these features.
|
||||
|
||||
* ``django.core.paginator.QuerySetPaginator`` is removed.
|
||||
|
||||
* A model's ``Meta.ordering`` doesn't affect ``GROUP BY`` queries.
|
||||
|
||||
* ``django.contrib.postgres.fields.FloatRangeField`` and
|
||||
``django.contrib.postgres.forms.FloatRangeField`` are removed.
|
||||
|
||||
|
||||
@@ -512,13 +512,6 @@ include the aggregate column.
|
||||
Interaction with default ordering or ``order_by()``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 2.2
|
||||
|
||||
Starting in Django 3.1, the ordering from a model's ``Meta.ordering`` won't
|
||||
be used in ``GROUP BY`` queries, such as ``.annotate().values()``. Since
|
||||
Django 2.2, these queries issue a deprecation warning indicating to add an
|
||||
explicit ``order_by()`` to the queryset to silence the warning.
|
||||
|
||||
Fields that are mentioned in the ``order_by()`` part of a queryset (or which
|
||||
are used in the default ordering on a model) are used when selecting the
|
||||
output data, even if they are not otherwise specified in the ``values()``
|
||||
|
||||
Reference in New Issue
Block a user