Ticket #5917: SelectDate_datetime.3.patch
File SelectDate_datetime.3.patch, 825 bytes (added by , 17 years ago) |
---|
-
django/newforms/extras/widgets.py
3 3 """ 4 4 5 5 import datetime 6 from types import StringTypes 6 7 7 8 from django.newforms.widgets import Widget, Select 8 9 from django.utils.dates import MONTHS … … 32 33 33 34 def render(self, name, value, attrs=None): 34 35 try: 35 value = datetime.date(*map(int, value.split('-'))) 36 if type(value) in StringTypes: 37 value = datetime.date(*map(int, value.split('-'))) 36 38 year_val, month_val, day_val = value.year, value.month, value.day 37 39 except (AttributeError, TypeError, ValueError): 38 40 year_val = month_val = day_val = None