#24347: parameter 'widget' of BoundField.as_widget is ignored
-------------------------------------+-------------------------------------
     Reporter:  srkunze              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Forms                |                  Version:  1.8beta1
     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):

 * status:  closed => new
 * version:  1.8alpha1 => 1.8beta1
 * resolution:  needsinfo =>


Comment:

 > It seems to me that BoundField.value/data need to use the field's widget
 rather than HiddenInput as the latter's value_from_datadict() doesn't know
 how to handle each field's data.

 It should use the HiddenInput all the time during the `as_hidden` call.

 Otherwise, the data given into a form and the data returned (e.g. after a
 POST) differs.

 Widgets set with `hidden_initial=True` render their data two times: with
 field.widget and with field.hidden_widget. Depending on whether or not its
 a bound form, results in different formatting of the value/data.


 This would be an example fix to show what I mean:
 
https://github.com/srkunze/django/commit/9480ce0c3853a47001bd12e339c263695c38978f


 `hidden_initial=True` results in `only_initial=True`. That means the
 '''hidden_initial parts''' of the POST data should not be changed.


 PS:
 Could somebody explain me the difference between '''data''' and
 '''value''' with regards to BoundFields? Looks quite messy to me (e.g.
 `BoundField.data` returns `value_from_datadict`; `prepare_value` gets
 `data`, but it expects `value` according to its definition).

--
Ticket URL: <https://code.djangoproject.com/ticket/24347#comment:11>
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.f322dfc4c963b517707bd1ff431ffd41%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to