Allow overriding `label`, `help_text` and `error_messages` for the default fields in `ModelForm`
|Reported by:||loic84||Owned by:||loic84|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
ModelForm requires to completely redefine fields in order to customize user-facing strings such as
This leads to a lot of boilerplate code to anyone who wants to customize these, but most importantly it's an error prone process. The bigger the ModelForm becomes, the more difficult it is to ensure functional parity between the
Model fields and the
Form fields for the critical parts such as blank/required, default, validators, etc.
One shouldn't be at risk of completely breaking a form functionality in order to make small cosmetic changes.
It's understood that we have to draw a line somewhere, else we would have field definitions in the
Meta, but I believe that line should be drawn at "anything cosmetic" available through
Meta overrides, and "anything functional" through fields overrides. I believe the currently provided
widgets lie in between the two, so it's almost surprising that it was added as a convenience in a first place instead of the purely cosmetic options.
Change History (15)
comment:4 Changed 4 years ago by
|Status:||closed → new|
|Triage Stage:||Unreviewed → Design decision needed|