diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-03-01 21:21:26 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-03-01 21:37:52 +0100 |
| commit | 4b8979e477a5315f3dfde0348393fd404fb70ee4 (patch) | |
| tree | 49f80594ac70b16970d090e183b766f36c572a8e /django/forms/widgets.py | |
| parent | 23c612199a8aaef52c3c7e05b66fb02ee0aac55b (diff) | |
Fixed #17401 -- Made SelectDateWidget.render reflect wrong value
Thanks Marcin Wrobel for the initial patch.
Diffstat (limited to 'django/forms/widgets.py')
| -rw-r--r-- | django/forms/widgets.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index fedd78c838..2ce3f42d6a 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -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) |
