Opened 5 years ago
Closed 5 years ago
#30742 closed New feature (wontfix)
ModelForm should allow passing update_fields to instance.save()
Reported by: | Václav Řehák | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 2.2 |
Severity: | Normal | Keywords: | modelform |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Model's save()
method allows specifying which fields to update using update_fields
kwarg (we are investigating this option to finetune db level permissions of our django instances).
However, using this feature with ModelForm is bit inconvenient as ModelForm.save()
calls self.instance.save()
making it impossible to pass the update_fields
to instance.save()
.
I think that add update_field
to ModelForm.save()
should be pretty straightforward change without backwards compatibility issues
Note:
See TracTickets
for help on using tickets.
I don't think this is worth the complication. It is easily implemented overriding save:
It's a marginal use-case, not justifying adding another
Meta
option here.