#28856: GenericForeignKey attributes create new instances on every access
-------------------------------------+-------------------------------------
Reporter: Morgan Wahl | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.10
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Morgan Wahl):
Thanks for looking at this Simon.
I should've been a bit clearer about the problem: on the instance return
from `refresh_from_db`, *every access of the GFK attribute* produces a
*different instance* of the related object. (I tried to show that with the
`id(ref.obj) == id(ref.obj)` line).
I called `refresh_from_db` just to simulate a real-world situation where
the row backing the `ref` instance here is created at some point, and at
some later point a new model instance is instantiated for that row.
--
Ticket URL: <https://code.djangoproject.com/ticket/28856#comment:4>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.52c3ee2107710a3a53b040f43ac10d87%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.