Allow rendering custom widgets from root templates dir (#2356)

* 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.

* update APP_DIRS=True

* fixup! update APP_DIRS=True
This commit is contained in:
Dani Hodovic 2020-01-28 10:55:09 +01:00 committed by Bruno Alla
parent f5aa06c160
commit 54a38bfb43

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/dev/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"