diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py index 108b2c56e2f..4dabafae9e0 100644 --- a/django/forms/extras/widgets.py +++ b/django/forms/extras/widgets.py @@ -2,6 +2,7 @@ Extra HTML Widget classes """ +import time import datetime import re @@ -46,7 +47,11 @@ class SelectDateWidget(Widget): if settings.USE_L10N: try: input_format = get_format('DATE_INPUT_FORMATS')[0] - v = datetime.datetime.strptime(value, input_format) + # Python 2.4 compatibility: + # v = datetime.datetime.strptime(value, input_format) + # 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 except ValueError: pass