jazzband / django-floppyforms

Full control of form rendering in the templates.
http://django-floppyforms.readthedocs.org/
Other
841 stars 148 forks source link

Hidden datetime inputs need to suppress microseconds. #102

Closed melinath closed 10 years ago

melinath commented 10 years ago

See https://code.djangoproject.com/ticket/22502 for original analysis.

If you have a form with empty_permitted=True (for example, an extra form in a formset) and that form has a datetime field defaulting to (timezone.)now, the form will fail always fail validation when you save.

The reason for this is that floppyforms' hidden input that is generated in this case includes microseconds - which django's hidden input (and the displayed input generated by both django and floppyforms) do not.

Example:

<input class="form-control" type="datetime" name="options-3-available_start" value="2014-04-24 08:03:22" required="" id="id_options-3-available_start">
<input type="hidden" name="initial-options-3-available_start" value="2014-04-24 08:03:22.688836" id="initial-options-3-id_options-3-available_start">
melinath commented 10 years ago

Ah... nope... it's a django thing after all. Blargh.