So, I recently observed that a Django ModelForm updates all columns when it 
is updating a model instance. This is appropriate for a typical situation 
where Django is also in control of the schema.
I also see that you can control this behavior by passing update_fields 
<https://docs.djangoproject.com/en/2.2/ref/models/instances/#saving-objects> 
to the save method, in a particular form:

    self.instance.save(update_fields=self.changed_data)

I have some complicated forms that have non-model fields and many-to-many 
fields mixed in there.   I'm wondering whether there is a module for Django 
out there that gives me some base ModelForms that do not update all fields, 
but only changed fields.  I am asking because I don't want to work hard to 
handle corner cases if there's something already out there.   What I 
already have is hard-coded to the form where I've made this change to do 
only a limited update.

Thanks,

-Dan

-- 
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/3c267866-3b46-4c20-a7a2-03cf581a5e98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to