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