mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #36077 -- Corrected docs on pk value where Model.save() executes an UPDATE.
The empty string is no longer special-cased since
c2ba59fc1d
.
This commit is contained in:
parent
76a0b6aa3a
commit
d66137b39b
1 changed files with 2 additions and 3 deletions
|
@ -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``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue