widgets: add template name to let checkbox widgets be overridden (#22403)

This commit is contained in:
Frédéric Péters 2018-03-09 13:19:06 +01:00
parent b874b30185
commit 1ce2a0082b
1 changed files with 2 additions and 0 deletions

View File

@ -503,6 +503,8 @@ class CheckboxWidget(quixote.form.CheckboxWidget):
Widget just like CheckboxWidget but with an effective support for the
required attribute, if required the checkbox will have to be checked.
'''
template_name = 'qommon/forms/widgets/checkbox.html'
def _parse(self, request):
self.value = self.name in request.form and not request.form[self.name] in (False, '', 'False')
if self.required and not self.value: