summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt15
-rw-r--r--docs/releases/3.2.txt3
2 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index d70f7deca3..6edc508661 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -2530,6 +2530,21 @@ update a bunch of records for a model that has a custom
e.comments_on = False
e.save()
+Ordered queryset
+^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.2
+
+Chaining ``order_by()`` with ``update()`` is supported only on MariaDB and
+MySQL, and is ignored for different databases. This is useful for updating a
+unique field in the order that is specified without conflicts. For example::
+
+ Entry.objects.order_by('-number').update(number=F('number') + 1)
+
+.. note::
+
+ If the ``order_by()`` clause contains annotations, it will be ignored.
+
``delete()``
~~~~~~~~~~~~
diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt
index 88c4cdc998..6c49cf5375 100644
--- a/docs/releases/3.2.txt
+++ b/docs/releases/3.2.txt
@@ -224,6 +224,9 @@ Models
* The new :attr:`.UniqueConstraint.opclasses` attribute allows setting
PostgreSQL operator classes.
+* The :meth:`.QuerySet.update` method now respects the ``order_by()`` clause on
+ MySQL and MariaDB.
+
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~