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