Problem with date field formatting and validation

6 views
Skip to first unread message

Kathy Adamska

unread,
Oct 21, 2013, 8:10:23 AM10/21/13
to django...@googlegroups.com
I have a custom form displaying ModelForm instance values like so:
<input type="text" name="test" value="{{ form.test.value|default_if_none:''|date:'m/d/Y' }}">
It works fine displaying the value the first time the form is loaded and saving it in the database. The problem arises when the form fails validation on any field - the field becomes blank. Other fields are not affected. This is not happening when I remove the formatting.
Reply all
Reply to author
Forward
0 new messages