#24347: parameter 'widget' of BoundField.as_widget is ignored
-------------------------------------+-------------------------------------
     Reporter:  srkunze              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Forms                |                  Version:  1.8alpha1
     Severity:  Normal               |               Resolution:
     Keywords:  BoundField,          |             Triage Stage:
  as_widget                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  1
-------------------------------------+-------------------------------------
Changes (by srkunze):

 * version:  master => 1.8alpha1
 * needs_tests:  0 => 1


Old description:

> '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

New description:

 '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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24347#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.eb464a25e566b1d06f1216687647637d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to