Opened 6 years ago

Last modified 6 years ago

#28942 closed Bug

ChoiceWidget.option_template_name ignores TEMPLATES DIRS — at Initial Version

Reported by: Maksim Iakovlev Owned by: nobody
Component: Forms Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django can only find template if it located in app dir (if path relative to BASE_DIR is myapp/templates/myapp/mytemplate.html), but raises TemplateDoesNotExist if template located in custom dir specified in TEMPLATES DIRS (if path relative to BASE_DIR is templates/myapp/mytemplate.html).

ChoiceWidget.option_template_name = 'myapp/mytemplate.html'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR, 'templates'),
        ],
        'APP_DIRS': True,
...

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top