#24347: parameter 'widget' of BoundField.as_widget is ignored
-------------------------------------+-------------------------------------
Reporter: srkunze | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.8alpha1
Severity: Normal | Resolution: needsinfo
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
-------------------------------------+-------------------------------------
Comment (by srkunze):
Replying to [comment:4 claudep]:
> Replying to [ticket:24347 srkunze]:
> > 'as_widget' has the parameter 'widget' which renders the field.
However, this parameter is not used all the time during the 'as_widget'
call.
>
> Sorry, but that's not true.
It is true.
> The widget parameter is used in `widget.render(...)` at the end of the
method.
I am not saying that this is the only possible place where the widget is
used.
> It's totally possible something is not working properly,
Please, carefully read my ticket again as I described what's wrong:
> 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.
> but then we'll need a more thorough example to demonstrate the issue.
Cf. my ticket again:
> The problem can also be observed when using BoundField.as_hidden as it
uses 'as_widget' as well.
`BouldField.as_hidden` should always use the HiddenWidget during
processing `BoundField.as_widget`, but `BouldField.data` uses the default
widget which is not the HiddenWidget of course.
A more concise presentation of the issue:
`BoundField.as_hidden` ---> `BoundField.as_widget` ---> `BoundField.value`
---> `BoundField.data`
"--->" means "uses"
`BoundField.as_hidden` specifies the HiddenWidget when it calls
`BoundField.as_widget`
`BoundField.value` and `BoundField.data` do not respect the specified
widget
Hence, the output is flawed.
--
Ticket URL: <https://code.djangoproject.com/ticket/24347#comment:5>
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.7b1ad5e40942a642fc8001ab400b97d6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.