summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorSalvo Polizzi <plzslv03a25c351k@studium.unict.it>2023-12-31 10:07:13 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-02 08:42:33 +0100
commit3915d4c70d0d7673abe675525b58117a5099afd3 (patch)
tree21f8f95cf8d816d91ed76d5f260c365a8551d17d /docs/ref/models
parente29d1870dd2b44f1b12c4ddf29b3fd24a903f7fd (diff)
Fixed #35060 -- Deprecated passing positional arguments to Model.save()/asave().
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/instances.txt12
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 81f9bfb433..45af7f244f 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -116,7 +116,7 @@ are loaded from the database::
return instance
- def save(self, *args, **kwargs):
+ def save(self, **kwargs):
# Check how the current values differ from ._loaded_values. For example,
# prevent changing the creator_id of the model. (This example doesn't
# support cases where 'creator_id' is deferred).
@@ -124,7 +124,7 @@ are loaded from the database::
self.creator_id != self._loaded_values["creator_id"]
):
raise ValueError("Updating the value of creator isn't allowed")
- super().save(*args, **kwargs)
+ super().save(**kwargs)
The example above shows a full ``from_db()`` implementation to clarify how that
is done. In this case it would be possible to use a ``super()`` call in the
@@ -410,8 +410,8 @@ Saving objects
To save an object back to the database, call ``save()``:
-.. method:: Model.save(force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None)
-.. method:: Model.asave(force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None)
+.. method:: Model.save(*, force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None)
+.. method:: Model.asave(*, force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None)
*Asynchronous version*: ``asave()``
@@ -424,6 +424,10 @@ method. See :ref:`overriding-model-methods` for more details.
The model save process also has some subtleties; see the sections below.
+.. deprecated:: 5.1
+
+ Support for positional arguments is deprecated.
+
Auto-incrementing primary keys
------------------------------