summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2025-01-09 09:50:30 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-13 11:18:02 +0100
commitd66137b39b1503ca3d4d4fac687251adbc845068 (patch)
treea95aca977ebdd9ad27b6416297e7f5d6914e274d
parent76a0b6aa3aa7bd62c2a9ba11306c906047ee7ada (diff)
Fixed #36077 -- Corrected docs on pk value where Model.save() executes an UPDATE.
The empty string is no longer special-cased since c2ba59fc1da5287d6286e2c2aca4083d5bafe056.
-rw-r--r--docs/ref/models/instances.txt5
1 files changed, 2 insertions, 3 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 57ebaf8e17..c2feca1181 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -552,9 +552,8 @@ object's primary key attribute does **not** define a
:attr:`~django.db.models.Field.default` or
:attr:`~django.db.models.Field.db_default`, Django follows this algorithm:
-* If the object's primary key attribute is set to a value that evaluates to
- ``True`` (i.e., a value other than ``None`` or the empty string), Django
- executes an ``UPDATE``.
+* If the object's primary key attribute is set to anything except ``None``,
+ Django executes an ``UPDATE``.
* If the object's primary key attribute is *not* set or if the ``UPDATE``
didn't update anything (e.g. if primary key is set to a value that doesn't
exist in the database), Django executes an ``INSERT``.