#33984: Related managers cache gets stale after saving a fetched model with new
PK
-------------------------------------+-------------------------------------
Reporter: joeli | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.1
(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 joeli):
Replying to [comment:2 Mariusz Felisiak]:
> This is a documented breaking change, however it also broke a
[https://docs.djangoproject.com/en/4.1/topics/db/queries/#copying-model-
instances documented way for copying model instances], so we need to
update docs or fix it.
Thanks, I was looking for that exact link to include in my original report
but couldn't find where it was mentioned. Maybe worth noting here that
adding `self._state.adding = True` before the save in .clone() does not
alter the result of this bug report.
FWIW I'd really like to see this fixed rather than addressed in the
documentation, as we are relying on this quite heavily in production code
to clone objects with deeply nested relations, so changing it to another
style would be a pain. Not only that but I don't think there's any other
documented way to duplicate objects in the ORM?
--
Ticket URL: <https://code.djangoproject.com/ticket/33984#comment:5>
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/010701831badbbed-0264d64a-ea12-403a-a6d8-0ad31938dda7-000000%40eu-central-1.amazonses.com.