Ticket #13592: selectdatewidget.patch
File selectdatewidget.patch, 1.3 KB (added by , 14 years ago) |
---|
-
django/forms/extras/widgets.py
7 7 import re 8 8 9 9 from django.forms.widgets import Widget, Select 10 from django.utils import datetime_safe 10 11 from django.utils.dates import MONTHS 11 12 from django.utils.safestring import mark_safe 12 13 from django.utils.formats import get_format … … 100 101 except ValueError: 101 102 pass 102 103 else: 104 date_value = datetime_safe.new_date(date_value) 103 105 return date_value.strftime(input_format) 104 106 else: 105 107 return '%s-%s-%s' % (y, m, d) -
tests/regressiontests/forms/extra.py
435 435 <option value="2016">2016</option> 436 436 </select> 437 437 438 Years before 1900 work 439 >>> w = SelectDateWidget(years=('1899',)) 440 >>> w.value_from_datadict({'date_year': '1899', 'date_month': '8', 'date_day': '13'}, {}, 'date') 441 '13-08-1899' 442 438 443 >>> translation.deactivate() 439 444 440 445 # MultiWidget and MultiValueField #############################################