Opened 9 years ago

Last modified 8 years ago

#24347 closed Bug

parameter 'widget' of BoundField.as_widget is ignored — at Version 3

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 Sven R. Kunze)

'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 (indirectly via 'value') 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

Versions: 1.4, 1.5, 1.6, 1.7, 1.8, master

Change History (3)

comment:1 by Sven R. Kunze, 9 years ago

Description: modified (diff)

comment:2 by Sven R. Kunze, 9 years ago

Description: modified (diff)

comment:3 by Sven R. Kunze, 9 years ago

Description: modified (diff)
Needs tests: set
Version: master1.8alpha1
Note: See TracTickets for help on using tickets.
Back to Top