Ticket #12986: 12986.diff
File 12986.diff, 1.2 KB (added by , 15 years ago) |
---|
-
django/forms/extras/widgets.py
43 43 except AttributeError: 44 44 year_val = month_val = day_val = None 45 45 if isinstance(value, basestring): 46 match = RE_DATE.match(value) 47 if match: 48 year_val, month_val, day_val = [int(v) for v in match.groups()] 49 46 if settings.USE_L10N: 47 input_format = get_format('DATE_INPUT_FORMATS')[0] 48 try: 49 val = datetime.datetime.strptime(value, input_format) 50 year_val, month_val, day_val = val.year, val.month, val.day 51 except ValueError: 52 pass 53 else: 54 match = RE_DATE.match(value) 55 if match: 56 year_val, month_val, day_val = [int(v) for v in match.groups()] 50 57 choices = [(i, i) for i in self.years] 51 58 year_html = self.create_select(name, self.year_field, value, year_val, choices) 52 59 choices = MONTHS.items()