﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14658	DateField initial does not honor locale, against documentation	Marti Raudsepp	nobody	"The documentation at http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.Field.initial suggests that when passing the `intial=` argument to Date``Field, it's converted to the locale date format:
{{{
>>> import datetime
>>> class DateForm(forms.Form):
...     day = forms.DateField(initial=datetime.date.today)
>>> print DateForm()
<tr><th>Day:</th><td><input type=""text"" name=""day"" value=""12/23/2008"" /><td></tr>
}}}

Notice that `value=""12/23/2008""` is localized.

However, this does not seem to work in practice:
{{{
In [1]: from django import forms

In [2]: import datetime

In [3]: class DateForm(forms.Form):
   ...:     day = forms.DateField(initial=datetime.date.today)

In [4]: print DateForm()
<tr><th><label for=""id_day"">Day:</label></th><td><input type=""text"" name=""day"" value=""2010-11-10"" id=""id_day"" /></td></tr>
}}}
Notice above `value=""2010-11-10""` -- it behaves this way in both Django 1.2.3 and in trunk.

Compare this to what the templater uses with its `|date` filter:

{{{
In [10]: from django.template import Template, Context

In [11]: t=Template(""{{ foo|date }}"")

In [12]: t.render(Context({'foo': datetime.date.today()}))
Out[12]: u'10.11.2010'

In [13]: from django.conf import settings

In [14]: settings.DATE_FORMAT
Out[14]: 'd.m.Y'

In [15]: settings.DATETIME_FORMAT
Out[15]: 'd.m.Y H:M:s'

In [16]: settings.USE_L10N
Out[16]: True
}}}
"	Bug	closed	Forms	1.5	Normal	needsinfo		django@…	Unreviewed	0	0	0	0	0	0
