SelectDateWidget should be updated to use new is_required Widget attribute
|Reported by:||mitar||Owned by:||nobody|
|Cc:||mmitar@…||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Overridden widgets in ModelForm do not respect blank (not required) flag of the model field because they are initialized in advance and already made object is passed for the widget.
The problem is for example with SelectDateWidget which is by default configured as required. So I have to manually set required constructor argument to False for model fields which are not required. This obviously contradicts DRY concept.
I propose that if required argument is not passed to the constructor explicitly then default should be taken from the model field and not that it is True by default.
Change History (12)
comment:1 follow-up: ↓ 2 Changed 6 years ago by carljm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to invalid
- Status changed from new to closed
comment:3 Changed 6 years ago by mitar
- Resolution invalid deleted
- Status changed from closed to reopened
comment:4 in reply to: ↑ 2 Changed 6 years ago by ramiro
- Triage Stage changed from Unreviewed to Design decision needed
comment:5 Changed 5 years ago by carljm
- Summary changed from Overridden widgets in ModelForm do not respect blank flag of model field to SelectDateWidget should be updated to use new is_required Widget attribute
- Triage Stage changed from Design decision needed to Accepted
- Version changed from 1.2 to SVN