summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/querysets.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 890395f6de..c819015b25 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -2774,8 +2774,9 @@ the direction is changed.
*Asynchronous version*: ``afirst()``
Returns the first object matched by the queryset, or ``None`` if there
-is no matching object. If the ``QuerySet`` has no ordering defined, then the
-queryset is automatically ordered by the primary key. This can affect
+is no matching object. If the ``QuerySet`` has no ordering defined (and has not
+had ordering forcibly cleared by calling :meth:`order_by` with no arguments),
+then the queryset is automatically ordered by the primary key. This can affect
aggregation results as described in :ref:`aggregation-ordering-interaction`.
Example::
@@ -2790,6 +2791,12 @@ equivalent to the above example::
except IndexError:
p = None
+.. versionchanged:: 6.1
+
+ ``first()`` and :meth:`last` no longer order by the primary key when
+ ordering has been forcibly cleared by calling :meth:`order_by` with no
+ arguments.
+
``last()``
~~~~~~~~~~