#31071: Change in behaviour when saving a model instance with an explcit pk
value
if the pk field has a default
-------------------------------------+-------------------------------------
Reporter: Reupen Shah | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by felixxm):
Replying to [comment:6 Simon Charette]:
> Note that this limitation was mentioned in
https://code.djangoproject.com/ticket/29260#comment:3 so another option
could be to document that `force_update` must be used in this particular
case. I feel like this would be good compromise. Regarding the fixture
loading we should branch of `raw`
[https://github.com/django/django/blob/master/django/core/serializers/base.py#L219-L223
which is passed by the serialization framework] to disable the
optimiation.
>
> Happy to provide a patch for whatever solution we choose. I think it's
worth adjusting the feature given it does reduce the number of queries
significantly when using primary key defaults and documenting it as a
backward incompatible change that can be worked around by passing
force_update...
I really like this proposition and I think it's fine to adjust the current
fix and backport it to the Django 3.0.
--
Ticket URL: <https://code.djangoproject.com/ticket/31071#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.10f9d6d8b43f8420199aa5c586f27207%40djangoproject.com.