[Django] #28486: Template FileLoader can't find widget templates

10 views
Skip to first unread message

Django

unread,
Aug 10, 2017, 2:59:25 AM8/10/17
to django-...@googlegroups.com
#28486: Template FileLoader can't find widget templates
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: nobody
Type: Bug | Status: new
Component: Template | Version: 1.11
system | Keywords: widgets, templates,
Severity: Normal | admin
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have both apps and file loaders in my project. I load custom directory
called "templates" in the root of the project.

In case I want to override template for field widget from Django Admin
(perhaps it related to regular widgets as well) and I create a file under
"templates/admin/widgets/clearable_file_input.html". Nothing happens. If I
will move it somewhere under "<my
app>/templates/widgets/clearable_file_input.html" it works fine. However,
I can override "admin/base.html" and few other templates from admin by
placing them in "templates/" folder.

I played around and found that when looking for templates for widget
Django loads all template directories for apps, but doesn't load anything
from DIRS parameter. In the same time, it loads everything properly for
other templates.

If description is messy or unclear please ask, and I will clarify unclear
parts.

--
Ticket URL: <https://code.djangoproject.com/ticket/28486>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 10, 2017, 9:38:13 AM8/10/17
to django-...@googlegroups.com
#28486: Template FileLoader can't find widget templates
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: widgets, templates, | Triage Stage:
admin | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


Comment:

Do you have `FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'` in
your settings? The default `DjangoTemplates` renderer doesn't consult the
`TEMPLATES` setting. Please read
[https://docs.djangoproject.com/en/stable/ref/forms/renderers/ The form
rendering API] documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/28486#comment:1>

Django

unread,
Nov 29, 2017, 9:22:27 AM11/29/17
to django-...@googlegroups.com
#28486: Template FileLoader can't find widget templates
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: widgets, templates, | Triage Stage:
admin | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Federico Capoano):

Hi,

I just stumbled upon this issue and found the solution thanks to this
ticket, therefore thank you very much for pointing out the solution.

However, I wonder why the behaviour that I expected (which I believe also
Andrey expected and anyone with a good experience with django would
expect) cannot be set as the default one.
Is it a backward compatibility issue, or what?

Best regards
Federico Capoano

--
Ticket URL: <https://code.djangoproject.com/ticket/28486#comment:2>

Django

unread,
Dec 28, 2017, 10:19:24 AM12/28/17
to django-...@googlegroups.com
#28486: Template FileLoader can't find widget templates
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: widgets, templates, | Triage Stage:
admin | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Paolo):

+1 for Federico Capoano and agree with his statement and the fact that the
pre-configured behaviour is NOT the one expected, I have lost quite a bit
of time on this and why I could not override the template using the
standard Django strategy.
I think that would have made much more sense to explain that the
"django.forms" app should be added in the installed apps to allow the
templates to be found!

--
Ticket URL: <https://code.djangoproject.com/ticket/28486#comment:3>

Django

unread,
Dec 28, 2017, 10:57:05 AM12/28/17
to django-...@googlegroups.com
#28486: Template FileLoader can't find widget templates
-------------------------------------+-------------------------------------
Reporter: Andrey | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: widgets, templates, | Triage Stage:
admin | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

Yes, there was [https://groups.google.com/d/topic/django-
developers/TmHdj5SCGNk/discussion extensive discussion] about this feature
and the decision about which renderer to use as the default.

--
Ticket URL: <https://code.djangoproject.com/ticket/28486#comment:4>

Reply all
Reply to author
Forward
0 new messages