I'm using a view that combines 2 forms (which were split in order to 
facilitate reuse and to separate concerns). The model instance I am sending 
to both is the same, so when one form sets the new values on the instance, 
the other can see them. The problem is that when the first form is saved, 
the changes made through the second form are also committed. Functionally, 
this is not a problem, but I also generate some historical records and 
expect to have 2 different historical records generated after these 
modifications - or in any case, I expect the fields to be grouped based on 
this separation. (Background: the records are generated by a *post_save* 
signal receiver).

My expectation was that updating an instance via a form will only update 
the set of fields specified in *ModelForm.Meta.fields*, not all the fields 
of the instance. It would also make a lot more sense in case the model has 
TextFields not included in the form being saved.
I know I could just call *super().save(commit=False)* and then just save 
the instance using the update_fields parameter, but I think this 
functionality should come out of the box.

My question is: Are there any considerations that I'm not aware of to 
prevent saving the instance with the *update_fields* set to 
*ModelForm.Meta.fields* in the base implementation of *ModelForm*?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a5dcfee-a8b6-4821-9107-e16485086a7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to