#34099: update_or_create() not saving data assigned in a model's save() method
-------------------------------------+-------------------------------------
Reporter: Phil Gyford | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: dev
(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
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* cc: Florian Apolloner, Sarah Boyce (added)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Thanks for the report! Unfortunately, this can be really tricky to fix.
You can fix this locally by updating `update_fields` (if needed), e.g.
{{{#!python
def save(self, *args, **kwargs):
if "update_fields" in kwargs:
kwargs["update_fields"].add("nickname")
self.nickname = self.name
super().save(*args, **kwargs)
}}}
Regression in 6cc0f22a73970dd7c0d29d4d8d2ff9e1cc862b30.
--
Ticket URL: <https://code.djangoproject.com/ticket/34099#comment:1>
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/01070183d811eeee-b845db35-06dc-4a37-b51b-395f930c0aee-000000%40eu-central-1.amazonses.com.