[Answered ]-Django form save can't be used update a model instance?

2👍

The construct_instance method is called in BaseModelForm._post_clean:

# BaseModelForm._post_clean()
# Update the model instance with self.cleaned_data.
self.instance = construct_instance(self, self.instance, opts.fields, construct_instance_exclude)

When this function is called, your “instance” will be updated with form data.

Note that _post_clean is called as part of BaseForm.full_clean, and is usually called indirectly by is_valid. This means that if you don’t validate your form, calling save method will either fail with a new instance, or fail to update an old instance.

Leave a comment