#24891: Warn if referencing a template by the same name as one in an installed
app
with higher precedence
---------------------------------+--------------------
Reporter: giuliettamasina | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
Due to how precedence works when looking up templates, you can write an
app that e.g. in one of its views references a template name in the same
app, but that will never actually be used if one by the same name exists
in another app that is listed earlier in `INSTALLED_APPS`.
This can be quite a surprise and frustration if you are not aware of it,
trying to debug why your template is not being used. The common solution
is to have an additional subdirectory in the app template folder, named
like the app itself. But you will have to find that out first, somehow.
I'd suggest some kind of warning is emitted if an installed app is
referencing a template name that also exists in another installed app with
higher precedence. The warning would ideally only happen if that template
actually exists in the app with lower precedence.
What do you think?
--
Ticket URL: <https://code.djangoproject.com/ticket/24891>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/058.475982a9ea20989d2dc0a90e61ba49c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.