{{{
form['mydate'].input_formats = ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y')
}}}
And if I post
{{{
form.data = {'mydate': '01/15/2013'}
}}}
The form will happily accepts the format.
However, if the date did not really change:
{{{
form.initial = {'mydate': '2013-01-15'}
form.data = {'mydate': '01/15/2013'}
}}}
'mydate' will show up in form.changed_data, because
widgets.DateInput._format_value can only use one format, there's no way to
make the widget recognize multiple formats.
--
Ticket URL: <https://code.djangoproject.com/ticket/21556>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0
Comment:
Are you really using Django 1.6? Some recent improvements have been made
in this realm. Change detection is now done on the field level and the
input value is transformed to a python date value before the comparison,
so generally what you describe should not happen.
Could you please give us a more comprehensive code example so as we can
better see what's happening in your case?
--
Ticket URL: <https://code.djangoproject.com/ticket/21556#comment:1>
* version: 1.6 => 1.5
Comment:
My apologizes, I am using 1.5.
--
Ticket URL: <https://code.djangoproject.com/ticket/21556#comment:2>
* resolution: needsinfo => worksforme
Comment:
Feel free to reopen if you can reproduce it with a more recent version.
--
Ticket URL: <https://code.djangoproject.com/ticket/21556#comment:3>