Let's say I have a model and an associated ModelForm and am doing the typical save of the ModelForm to modify the instance. I'd like to generate a report that identifies what fields were changed and what the old and new values were. I initially did this by doing a deepcopy of my instance, then saving the ModelForm, then just comparing the copy with the saved instance. This works fine when I have no ManyToMany fields. But now that I have a ManyToMany field, I find that deepcopy doesn't really "deepcopy" the ManyToMany field. Instead, after I save the ModelForm, the deepcopy of the instance now points to the new ManyToMany field. IE, if my Manytomany field is 'publications' and the model form specifies 3 new publications, the deepcopied version of the instance (created prior to saving the ModelForm) now has a field 'publications' which contains those 3 new publications.
It looks like to get this right I would have to subclass ManyToManyField and provide a __deepcopy__ method. Is there some easier way of doing this that I'm missing? Thanks! Margie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---