#27846: refresh_from_db() does not create "soft links" on model_instances that
are
pointed to by another model's OneToOneField
-------------------------------------+-------------------------------------
Reporter: Keith Hostetler | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.10
(models, ORM) |
Severity: Normal | Resolution:
Keywords: refresh_from_db | Triage Stage:
OneToOneField | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Keith Hostetler:
Old description:
> Sorry for the poor summary, it is difficult to explain in words. I have a
> project to demo this bug attached to this ticket, but I will try to
> explain the bug anyway in steps and the setup.
>
> Setup:
> - 2 models (A and B)
> - B has a OneToOne to A
> - Both A and B have a field (ie TextField)
> - Setup either a signal or override save() for A to update B's TextField
> to equal that of A's on save() or post_save for signals
>
> Steps:
> - Create instance of A
> - Get another copy of the instance of A via A.objects.get()
> - Create instance of B using the copy of the instance of A
> - Do refresh_from_db() on original instance of A
> - Try to access B from A
>
> The project I have provided is a slim version of this problem that
> demonstrates it with signals, overriden save(), and basic set and save
> inside the test. The basic set and save works, but the other two fail
> when using the above steps.
New description:
Sorry for the poor summary, it is difficult to explain in words. I have a
project to demo this bug attached to this ticket, but I will try to
explain the bug anyway in steps and the setup.
Setup:
- 2 models (A and B)
- B has a OneToOne to A
- Both A and B have a field (ie TextField)
- Setup either a signal or override save() for A to update B's TextField
to equal that of A's on save() or post_save for signals
Steps:
- Create instance of A
- Get another copy of the instance of A via A.objects.get()
- Create instance of B using the copy of the instance of A
- Do refresh_from_db() on original instance of A
- Try to access B from A
The project I have provided is a slim version of this problem that
demonstrates it with signals, overriden save(), and basic set and save
inside the test. The basic set and save works, but the other two fail when
using the above steps. Run the test suite to see.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27846#comment:2>
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/067.cd4c0a4107be04ea3df8c9a8cef2d436%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.