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|
Currently ModelForm requires to completely redefine fields in order to customize user-facing strings such as labels, help_texts and error_messages.
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:1 Changed 3 years ago by loic84
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 3 years ago by carljm
- Resolution wontfix deleted
- Status changed from closed to new
- Triage Stage changed from Unreviewed to Design decision needed