#30491 closed Cleanup/optimization (fixed)
Document changing primary key behavior in "How Django knows to UPDATE vs. INSERT" section.
Reported by: | Brad | Owned by: | Brad |
---|---|---|---|
Component: | Documentation | Version: | 2.2 |
Severity: | Normal | Keywords: | save |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
PR: https://github.com/django/django/pull/11390
The docs for 'How Django knows to UPDATE vs. INSERT'
do not make any mention of a potentially confusing condition,
which is that updating a PK followed by a call to .save()
will always result in an INSERT rather than an UPDATE.
While this note is present in the primary key docstring
itself, it would be worthwhile to duplicate it to this section
as a gotcha.
Change History (5)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Summary: | Make note on exception to UPDATE-v-INSERT logic → Document changing primary key behavior in "How Django knows to UPDATE vs. INSERT" section. |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
Has patch: | set |
---|
comment:3 by , 5 years ago
Patch needs improvement: | set |
---|
Note:
See TracTickets
for help on using tickets.
This note is already in
topics/db/models
andref/models/fields
, but I agree that we can add it in one more place.