#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 Mariusz Felisiak):
Replying to [comment:8 Bhuvnesh]:
> Can anyone write a regression test for this one?
A regression test is already in
[https://docs.djangoproject.com/en/stable/topics/db/queries/#copying-
model-instances docs]:
{{{#!python
entry = Entry.objects.all()[0] # some previous entry
old_authors = entry.authors.all()
entry.pk = None
entry._state.adding = True
entry.save()
entry.authors.set(old_authors)
self.assertCountEqual(entry.authors.all(), [...])
}}}
Have you check previous comments?
--
Ticket URL: <https://code.djangoproject.com/ticket/33984#comment:9>
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/0107018326c7208a-db38e924-c19b-4e43-9821-92dac895fc26-000000%40eu-central-1.amazonses.com.