#33972: Copying model instances of many-to-many field doesn't apply changes to
database
-----------------------------------------+------------------------
Reporter: Eido Askayo | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In section [https://docs.djangoproject.com/en/4.0/topics/db/queries
/#copying-model-instances Copying model instances], the following code is
shown:
{{{
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)
}}}
{{{entry.save()}}} applies changes to database, but
{{{entry.authors.set(old_authors)}}} doesn't.
--
Ticket URL: <https://code.djangoproject.com/ticket/33972>
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/01070182f91ff739-4ca9eb85-6e94-4f5c-a813-bc871741ac25-000000%40eu-central-1.amazonses.com.