summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-02-04 23:46:30 +0000
committerRamiro Morales <cramm0@gmail.com>2011-02-04 23:46:30 +0000
commit2d7049c4ee45e8d4820cdf8106a41a9f4a8331da (patch)
treebb5cbbba5fda3e34c4599b61b54ddecf5983d585 /django/forms
parent0ffa39f744d339756b4743d240f32430b7c35cd4 (diff)
Fixed #13968 -- Fixed SelectDateWidget processing of an invalid date input value when USE_L10N is on, for consistency with its behavior when USE_L10N=False (now the form field reports the validation error in both cases). Thanks mitar for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15416 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/extras/widgets.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
index 8f13ed6c62..0cd88b8170 100644
--- a/django/forms/extras/widgets.py
+++ b/django/forms/extras/widgets.py
@@ -50,7 +50,7 @@ class SelectDateWidget(Widget):
input_format = get_format('DATE_INPUT_FORMATS')[0]
# Python 2.4 compatibility:
# v = datetime.datetime.strptime(value, input_format)
- # would be clearer, but datetime.strptime was added in
+ # would be clearer, but datetime.strptime was added in
# Python 2.5
v = datetime.datetime(*(time.strptime(value, input_format)[0:6]))
year_val, month_val, day_val = v.year, v.month, v.day
@@ -99,7 +99,7 @@ class SelectDateWidget(Widget):
try:
date_value = datetime.date(int(y), int(m), int(d))
except ValueError:
- pass
+ return '%s-%s-%s' % (y, m, d)
else:
date_value = datetime_safe.new_date(date_value)
return date_value.strftime(input_format)