Opened 10 years ago
Last modified 9 years ago
#24347 closed Bug
parameter 'widget' of BoundField.as_widget is ignored — at Version 1
Reported by: | Sven R. Kunze | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | BoundField, as_widget, hidden, initial, hidden_initial |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | yes |
Description (last modified by )
'as_widget' has the parameter 'widget' which renders the field. However, this parameter is not used all the time during the 'as_widget' call.
The method 'data', which is called by 'as_widget' ALWAYS used the default widget of the field which leads to issues like formatting etc.
We recognized this issue when using 'show_hidden_initial=True' and widgets for datetime objects.
The problem can also be observed when using BoundField.as_hidden as it uses 'as_widget' as well.
cf.
as_widget: https://github.com/django/django/blob/master/django/forms/forms.py#L526
data: https://github.com/django/django/blob/master/django/forms/forms.py#L569
as_hidden: https://github.com/django/django/blob/master/django/forms/forms.py#L562