[Django] #30491: Make note on exception to UPDATE-v-INSERT logic

10 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Django

ungelesen,
19.05.2019, 17:54:4919.05.19
an django-...@googlegroups.com
#30491: Make note on exception to UPDATE-v-INSERT logic
------------------------------------------------+------------------------
Reporter: Brad | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 2.2
Severity: Normal | Keywords: save
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
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.

See also: https://stackoverflow.com/q/56212145/7954504

--
Ticket URL: <https://code.djangoproject.com/ticket/30491>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

ungelesen,
20.05.2019, 07:53:5020.05.19
an django-...@googlegroups.com
#30491: Document changing primary key behavior in "How Django knows to UPDATE vs.
INSERT" section.
--------------------------------------+------------------------------------
Reporter: Brad | Owner: Brad
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2
Severity: Normal | Resolution:
Keywords: save | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* status: new => assigned
* owner: nobody => Brad
* stage: Unreviewed => Accepted


Comment:

This note is already in `topics/db/models` and `ref/models/fields`, but I
agree that we can add it in one more place.

--
Ticket URL: <https://code.djangoproject.com/ticket/30491#comment:1>

Django

ungelesen,
20.05.2019, 07:54:2420.05.19
an django-...@googlegroups.com
#30491: Document changing primary key behavior in "How Django knows to UPDATE vs.
INSERT" section.
--------------------------------------+------------------------------------
Reporter: Brad | Owner: Brad
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: save | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30491#comment:2>

Django

ungelesen,
24.05.2019, 07:04:3124.05.19
an django-...@googlegroups.com
#30491: Document changing primary key behavior in "How Django knows to UPDATE vs.
INSERT" section.
--------------------------------------+------------------------------------
Reporter: Brad | Owner: Brad
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.2

Severity: Normal | Resolution:
Keywords: save | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30491#comment:3>

Django

ungelesen,
28.05.2019, 05:28:2728.05.19
an django-...@googlegroups.com
#30491: Document changing primary key behavior in "How Django knows to UPDATE vs.
INSERT" section.
--------------------------------------+------------------------------------
Reporter: Brad | Owner: Brad
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.2
Severity: Normal | Resolution: fixed

Keywords: save | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"67b6cb7723b2765cb776bd59d5603e3e63eefc2e" 67b6cb77]:
{{{
#!CommitTicketReference repository=""
revision="67b6cb7723b2765cb776bd59d5603e3e63eefc2e"
Fixed #30491 -- Clarified when save() on object with pk executes INSERT.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30491#comment:4>

Django

ungelesen,
28.05.2019, 05:29:2528.05.19
an django-...@googlegroups.com
#30491: Document changing primary key behavior in "How Django knows to UPDATE vs.
INSERT" section.
--------------------------------------+------------------------------------
Reporter: Brad | Owner: Brad
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.2

Severity: Normal | Resolution: fixed
Keywords: save | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"0f0d1cd7722238158011c7717d410fae37513ceb" 0f0d1cd]:
{{{
#!CommitTicketReference repository=""
revision="0f0d1cd7722238158011c7717d410fae37513ceb"
[2.2.x] Fixed #30491 -- Clarified when save() on object with pk executes
INSERT.

Backport of 67b6cb7723b2765cb776bd59d5603e3e63eefc2e from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30491#comment:5>

Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten