diff options
| author | Brad Solomon <brad.solomon.1124@gmail.com> | 2019-05-27 08:47:15 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-05-28 11:02:26 +0200 |
| commit | 67b6cb7723b2765cb776bd59d5603e3e63eefc2e (patch) | |
| tree | 76110212a0b1ba4a499864f54952f7b22e25ad82 /docs | |
| parent | a3f91891d2c7f4bdc33f48ae70820ef6f36da26e (diff) | |
Fixed #30491 -- Clarified when save() on object with pk executes INSERT.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/instances.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 3119527c3b..edc4459f1c 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -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 |
