Allow rendering custom widgets from root templates dir

Rendering custom widgets from the projects root template directory
doesn't work out of the box.

See: https://stackoverflow.com/questions/45844032/django-templatedoesnotexist-in-case-of-a-custom-widget/46208414#46-208414

This changes the setting to use the same template finding logic that the
TEMPLATES setting uses.
This commit is contained in:
Dani Hodovic 2019-12-10 13:44:00 +01:00
parent f5aa06c160
commit a681ac4e45
No known key found for this signature in database
GPG Key ID: 15433E10A71D1221

View File

@ -68,6 +68,7 @@ DJANGO_APPS = [
"django.contrib.staticfiles",
# "django.contrib.humanize", # Handy template tags
"django.contrib.admin",
"django.forms",
]
THIRD_PARTY_APPS = [
"crispy_forms",
@ -196,6 +197,10 @@ TEMPLATES = [
},
}
]
# https://docs.djangoproject.com/en/3.0/ref/settings/#form-renderer
FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
# http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
CRISPY_TEMPLATE_PACK = "bootstrap4"