mirror of
https://github.com/django/django.git
synced 2025-03-12 10:22:37 +00: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'
|
template_name = 'django/forms/widgets/select_date.html'
|
||||||
input_type = 'select'
|
input_type = 'select'
|
||||||
select_widget = 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):
|
def __init__(self, attrs=None, years=None, months=None, empty_label=None):
|
||||||
self.attrs = attrs or {}
|
self.attrs = attrs or {}
|
||||||
|
@ -482,6 +482,7 @@ class SelectDateWidgetTest(WidgetTest):
|
|||||||
valid_formats = [
|
valid_formats = [
|
||||||
'2000-1-1', '2000-10-15', '2000-01-01',
|
'2000-1-1', '2000-10-15', '2000-01-01',
|
||||||
'2000-01-0', '2000-0-01', '2000-0-0',
|
'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:
|
for value in valid_formats:
|
||||||
year, month, day = (int(x) for x in value.split('-'))
|
year, month, day = (int(x) for x in value.split('-'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user