mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #13970 -- Made SelectDateWidget use the standard widget is_required attribute
Thanks mitar for the report and Tim Graham for the review.
This commit is contained in:
@@ -53,9 +53,8 @@ class SelectDateWidget(Widget):
|
||||
day_field = '%s_day'
|
||||
year_field = '%s_year'
|
||||
|
||||
def __init__(self, attrs=None, years=None, required=True, months=None):
|
||||
def __init__(self, attrs=None, years=None, months=None):
|
||||
self.attrs = attrs or {}
|
||||
self.required = required
|
||||
|
||||
# Optional list or tuple of years to use in the "year" select box.
|
||||
if years:
|
||||
@@ -139,7 +138,7 @@ class SelectDateWidget(Widget):
|
||||
id_ = self.attrs['id']
|
||||
else:
|
||||
id_ = 'id_%s' % name
|
||||
if not (self.required and val):
|
||||
if not self.is_required:
|
||||
choices.insert(0, self.none_value)
|
||||
local_attrs = self.build_attrs(id=field % id_)
|
||||
s = Select(choices=choices)
|
||||
|
||||
Reference in New Issue
Block a user