Skip to content

Commit

Permalink
[2.2.x] Fixed #30491 -- Clarified when save() on object with pk execu…
Browse files Browse the repository at this point in the history
…tes INSERT.

Backport of 67b6cb7 from master
  • Loading branch information
bsolomon1124 authored and felixxm committed May 28, 2019
1 parent 1172f07 commit 0f0d1cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/ref/models/instances.txt
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ follows this algorithm:
``True`` (i.e., a value other than ``None`` or the empty string), Django
executes an ``UPDATE``.
* If the object's primary key attribute is *not* set or if the ``UPDATE``
didn't update anything, Django executes an ``INSERT``.
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``.

The one gotcha here is that you should be careful not to specify a primary-key
value explicitly when saving new objects, if you cannot guarantee the
Expand Down

0 comments on commit 0f0d1cd

Please sign in to comment.