Hello,
when porting a django application from 3.1.13 to 3.2.5 I found a behavior change
I don't see documented in the release notes.
The code is cloning a an object and all its related objects by settings the pk
to None. Previously storing a queryset of related objects was enough to being
able to iterate on that even if the original object was cloned, now we have to
make it concrete by calling list() on it.
Code was something like the following:
def clone_object(obj):
related_objs = obj.relatedobj_set.all()
obj.pk = None
obj.save()
for related in related_objs:
related.pk = None
related.object = obj
related.save()
And now the related_object line is as:
related_objs = list(obj.relatedobj_set.all())
Is it something that should be documented in the release notes?
Thanks
--
Riccardo Magliocchetti
@rmistaken
http://menodizero.it
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/2472148f-0503-65de-c3cd-8a0ad4903011%40gmail.com.