mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #27724 -- Fixed SelectDateWidget redisplay if a year isn't chosen.
This commit is contained in:
parent
fb48ad348a
commit
cd2ad26cc9
@ -894,7 +894,7 @@ class SelectDateWidget(Widget):
|
||||
template_name = 'django/forms/widgets/select_date.html'
|
||||
input_type = 'select'
|
||||
select_widget = Select
|
||||
date_re = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
|
||||
date_re = re.compile(r'(\d{4}|0)-(\d\d?)-(\d\d?)$')
|
||||
|
||||
def __init__(self, attrs=None, years=None, months=None, empty_label=None):
|
||||
self.attrs = attrs or {}
|
||||
|
@ -482,6 +482,7 @@ class SelectDateWidgetTest(WidgetTest):
|
||||
valid_formats = [
|
||||
'2000-1-1', '2000-10-15', '2000-01-01',
|
||||
'2000-01-0', '2000-0-01', '2000-0-0',
|
||||
'0-01-01', '0-01-0', '0-0-01', '0-0-0',
|
||||
]
|
||||
for value in valid_formats:
|
||||
year, month, day = (int(x) for x in value.split('-'))
|
||||
|
Loading…
Reference in New Issue
Block a user