#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
-------------------------------------+-------------------------------------
Comment (by srkunze):
Replying to [comment:18 timgraham]:
> I think datetimes maybe complicating the issue.
Unfortunately, it is that complicated. Formatting (and its consistency
over the life-time of the form) is the issue here. That is why I chose
date inputs.
Replying to [comment:18 timgraham]:
> It seems like at least one of the issues is that for the following form:
> {{{
> class MyForm(forms.Form):
> foo = forms.IntegerField(initial=1, show_hidden_initial=True)
>
> form = MyForm({'foo': 5})
> }}}
Actually, it should look like this as browsers send `initial-foo` as well:
{{{
form = MyForm({'foo': 5, 'initial-foo': 1})
}}}
> You expect the hidden input to be rendered with "1" instead of "5".
> {{{
> <label for="id_foo">Foo:</label>
> <input id="id_foo" type="number" value="5" name="foo">
> <input id="initial-id_foo" type="hidden" value="5" name="initial-foo">
> }}}
> Is that correct?
Interesting. You accidentally found another error.
I created another commit and added more tests to cover all that.
> By the way, I tried looking at your tests, but they didn't pass even
when I uncommented "# uncomment to see changes with correctly formatted
hidden-initial" -- not sure if that was intended or not?
The comments were currently not intended to make the tests pass. They just
represent how **well-formed** POST data would look like IF the unbound
form would have produced correctly formatted hidden-initial data.
--
Ticket URL: <https://code.djangoproject.com/ticket/24347#comment:19>
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.9b42993bd9f55252012e56f067c0a3bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.