1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #13560 -- Fixed localization of widgets.

Particularly this fixes the SplitDateTimeField and the AdminDateWidget by localizating the widget's value in its render method instead of the form field. Thanks to David Danier for the report and Russell for help with the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel
2010-05-21 14:07:54 +00:00
parent 8a6cb3d969
commit b057a8b247
7 changed files with 43 additions and 35 deletions

View File

@@ -1135,6 +1135,7 @@ u'<input type="text" name="date" value="2007-09-17 12:51:34" />'
u'<input type="text" name="date" value="2007-09-17 12:51:00" />'
>>> activate('de-at')
>>> settings.USE_L10N = True
>>> w.is_localized = True
>>> w.render('date', d)
u'<input type="text" name="date" value="17.09.2007 12:51:34" />'
>>> deactivate()
@@ -1176,6 +1177,7 @@ u'<input type="text" name="date" value="2007-09-17" />'
>>> activate('de-at')
>>> settings.USE_L10N = True
>>> w.is_localized = True
>>> w.render('date', d)
u'<input type="text" name="date" value="17.09.2007" />'
>>> deactivate()
@@ -1220,6 +1222,7 @@ u'<input type="text" name="time" value="13:12:11" />'
>>> activate('de-at')
>>> settings.USE_L10N = True
>>> w.is_localized = True
>>> w.render('date', d)
u'<input type="text" name="date" value="17.09.2007" />'
>>> deactivate()
@@ -1259,6 +1262,7 @@ u'<input type="hidden" name="date_0" value="2007-09-17" /><input type="hidden" n
u'<input type="hidden" name="date_0" value="2007-09-17" /><input type="hidden" name="date_1" value="12:51:00" />'
>>> activate('de-at')
>>> settings.USE_L10N = True
>>> w.is_localized = True
>>> w.render('date', datetime.datetime(2007, 9, 17, 12, 51))
u'<input type="hidden" name="date_0" value="17.09.2007" /><input type="hidden" name="date_1" value="12:51:00" />'
>>> deactivate()