From 1.2 release notes (backward incompatible change):
"Much of the validation work for ModelForms has been moved down to the
model level. As a result, the first time you call
ModelForm.is_valid(), access ModelForm.errors or otherwise trigger
form validation, your model will be cleaned in-place. This conversion
used to happen when the model was saved. If you need an unmodified
instance of your model, you should pass a copy to the ModelForm
I am migrating from 1.1 to 1.3. Some of my code rely on model not
being cleaned in place. As some fields become read only and should
not be changed. This 1.2 functionality makes those field empty. Also I
save the model and not the form in these cases.
So as per documentation, to get around it, I need to pass a copy of
model to form. What is the best way to get a copy of model:
1) use deepcopy?
2) get the object twice from db? (slow as more db access)
Any downsides to using deepcopy? Anything I need to be careful about?
Anyone else also had this issue and any suggestions.