#31891: Remove cached value of reverse side of 020 relation when updating
attname.
-------------------------------------+-------------------------------------
Reporter: Josh | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
orm,related,onetoone |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sanghyuk Jeong):
I've submitted a PR for this ticket:
https://github.com/django/django/pull/20690
The fix extends ForeignKeyDeferredAttribute.__set__ to clear the reverse
one-to-one cache on the previously-related object when the FK attname
value changes (e.g., profile.user_id = new_id). The cache invalidation is
scoped to one-to-one relations only and operates entirely on already-
cached values — no additional database queries are introduced.
Three regression tests are included covering non-nullable O2O, nullable
O2O, and reverse cache repopulation after forward access.
--
Ticket URL: <https://code.djangoproject.com/ticket/31891#comment:7>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019c56050a64-b2a0f49e-3f7d-43be-befe-a81a38cf6698-000000%40eu-central-1.amazonses.com.