From 56743cf9e337826e4c615909570bb057142a6a7b Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Sat, 21 Sep 2013 22:54:00 +0200 Subject: [PATCH] Ensured that BoundField.as_widget always returns properly localized fields. This is a follow-up to #18777 which improperly converted to strings in prepare_value and as such caused regressions like #21074. Refs #18777, #21074 --- django/forms/fields.py | 3 --- django/forms/forms.py | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/django/forms/fields.py b/django/forms/fields.py index d90b8dbb51..7e4e5df833 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -115,8 +115,6 @@ class Field(object): super(Field, self).__init__() def prepare_value(self, value): - if self.widget.is_localized: - value = formats.localize_input(value) return value def to_python(self, value): @@ -468,7 +466,6 @@ class DateTimeField(BaseTemporalField): } def prepare_value(self, value): - value = super(DateTimeField, self).prepare_value(value) if isinstance(value, datetime.datetime): value = to_current_timezone(value) return value diff --git a/django/forms/forms.py b/django/forms/forms.py index 64d1550066..490d9c2c3b 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -463,6 +463,9 @@ class BoundField(object): if not widget: widget = self.field.widget + if self.field.localize: + widget.is_localized = True + attrs = attrs or {} auto_id = self.auto_id if auto_id and 'id' not in attrs and 'id' not in widget.attrs: