Template libraries and built-ins should be registered through the engine
Django template libraries and builtins depend on global variables in django.template.base
. This is messy, but also restrictive. The only way to specify template tag modules is by adding a package in INSTALLED_APPS
that has a templatetags
directory. Modifying builtins
is a hack. And the LoadNode
has a hard dependency on django.apps
. Preferably, libraries and builtins should be specified and live on the Engine
instance instead.
I think this can be cleaned up by having libraries and builtins configured via the DjangoTemplates
backend. This would build on Mark Tamlyn's idea in #12772:
TEMPLATES = [
{
...
'OPTIONS': {
'libraries': {
'admin.urls': 'django.contrib.admin.templatetags.admin_urls',
'my_tags': 'path.to.some.module',
},
'builtins': {
'path.to.builtins_module',
}
},
},
]
Change History
(11)
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to andrei kulakov
|
Status: |
new → assigned
|
Owner: |
andrei kulakov removed
|
Status: |
assigned → new
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Owner: |
set to Preston Timmons <prestontimmons@…>
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Hi akulokov,
I have a PR close to ready on this ticket. Just wanted to let you know since you assigned yourself, and I forgot to assign myself earlier.