I need to wrap the fields in div. In Django 1.10:
class CustomSelectDateWidget (SelectDateWidget):
def render(self, name, value, attrs=None):
...
output = []
for field in self._parse_date_fmt():
if field == 'year':
output.append('<div class="input-field col s4">' + html['year'] + '</div>')
elif field == 'month':
output.append('<div class="input-field col s5">' + html['month'] + '</div>')
elif field == 'day':
output.append('<div class="input-field col s3">' + html['day'] + '</div>')
return mark_safe('\n'.join(output))
It dosn`t work in Django 1.11. I tried to override 'django/forms/widgets/select_date.html':
class CustomDateWidget(SelectDateWidget):
def get_template_names(self):
return ['accounts/custom_select_date.html']
But Django include 'django/forms/widgets/select_date.html' instead of my template 'accounts/templates/accounts/custom_select_date.html'. No error messages are displayed.