#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
-------------------------------------+-------------------------------------
Description changed by srkunze:

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

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 uses 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/1.8a1/django/forms/forms.py#L566
 data:
 https://github.com/django/django/blob/1.8a1/django/forms/forms.py#L609
 as_hidden:
 https://github.com/django/django/blob/1.8a1/django/forms/forms.py#L602

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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24347#comment:8>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.a98f01d62cac7c4c53d2e271a31d2d0f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to