Thanks, I wrote a mixin class for most of my forms that works a lot like this, although it combines self.changed_fields and self.model._meta.fields to discover which fields to update, rather than the two stages you have above.
I discovered when trying to generalize this mixin that some of my forms are too complicated for this to be a part of Django itself. A ModelForm may have non-model fields whose initial value is computed from other models in __init__ or using a queryset with annotations. I've found this to be easier in many cases that dealing with formsets. So, if your save method already looks something like this: def save(self, commit=True): with transactions.atomic(): instance = super().save() instance.relation.fubar = self.changed_data['relation_fubar'] instance.relation.save() Well, you might as well just figure out update_fields in that form on its own. -- 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/0310b0a5-05f2-4faf-8c69-a911ed82976f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.