Fixed #17401 -- Made SelectDateWidget.render reflect wrong value

Thanks Marcin Wrobel for the initial patch.
This commit is contained in:
Claude Paroz 2015-03-01 21:21:26 +01:00
parent 23c612199a
commit 4b8979e477
2 changed files with 5 additions and 2 deletions

View file

@ -977,10 +977,10 @@ class SelectDateWidget(Widget):
year_val, month_val, day_val = v.year, v.month, v.day
except ValueError:
pass
else:
if year_val is None:
match = self.date_re.match(value)
if match:
year_val, month_val, day_val = [int(v) for v in match.groups()]
year_val, month_val, day_val = [int(val) for val in match.groups()]
html = {}
choices = [(i, i) for i in self.years]
html['year'] = self.create_select(name, self.year_field, value, year_val, choices, self.year_none_value)