Django widget template override does not search in the project template directory. How to fix? Django widget template override does not search in the project template directory. How to fix? python python

Django widget template override does not search in the project template directory. How to fix?


By default, the FORM_RENDERER setting defaults to 'django.forms.renderers.DjangoTemplates'.

This checks your apps' templates directory (e.g. projectroot/myapp/templates/myapp/my_file_widget.html), but it does not check your project's template directories (e.g. projectroot/templates/myapp/my_file_widget.html).

If you want to use the same configuration as your TEMPLATES setting, then you should use the TemplatesSetting renderer.

FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'

You will also need to update your TEMPLATES setting so that Django can still use the built in widget templates. The easiest way to do this is to add django.forms to INSTALLED_APPS. See the docs for more info about this.