summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-07-03 10:16:48 -0400
committerTim Graham <timograham@gmail.com>2017-07-06 07:41:57 -0400
commit81febf4defe6f6da2dea80f24082b282b8bf30ca (patch)
treebaf5190d071fef472e54d6c7e2f105de202c5de6 /django/forms/widgets.py
parent72026fff3963973d607bf0b525a082d20f024406 (diff)
[1.11.x] Fixed #28355 -- Fixed widget rendering of non-ASCII date/time formats on Python 2.
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index c2bc534e5a..67108e450b 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -463,7 +463,9 @@ class DateTimeBaseInput(TextInput):
self.format = format if format else None
def format_value(self, value):
- return formats.localize_input(value, self.format or formats.get_format(self.format_key)[0])
+ if value is not None:
+ # localize_input() returns str on Python 2.
+ return force_text(formats.localize_input(value, self.format or formats.get_format(self.format_key)[0]))
class DateInput(DateTimeBaseInput):