I would like to change the way a widget is rendered in Django. I've read this guide https://docs.djangoproject.com/en/2.0/ref/forms/renderers/ but still I can't make it working.
I've create this widget
class MultiChoiceFilterWidget(forms.widgets.CheckboxSelectMultiple):
template_name = 'web_admin/partial/checkbox.html'
but it's not working in the sense that the default look-and-feel is displayed, there's no sign of my edits.
In TEMPLATES
I've the folder myproject.web
and the folder structure is myproject/web/templates/web_admin/partial/checkbox.html
What Am I missing?
(I also tried to put a file in django/forms/widgets/checkbox_select.html
that is the file the widget is looking for, but still not working)
edit
in settings.py
INSTALLED_APPS = [
...
'web',
...
]
in forms.py
class MyChoiceForm(ModelForm):
class Meta:
model = MyModel
fields = ('theField',)
widgets = {
'theField': MultiChoiceFilterWidget,
}
edit2 Update the question to reflect the fact that this works for plain django, not with crispy form.