djblets.template.loaders.namespaced_app_dirs¶
- class Loader(*args, **kwargs)¶
Bases:
Loader
Looks for templates in app directories, optionally with a namespace.
This extends the standard Django ‘app_directories’ template loader by allowing a prefix specifying the app whose template should be used. It solves the problem of one app defining a template and another app trying to both override and extend it, resulting in an infinite loop.
Templates can be in the standard form of ‘path/to/template’, or in the namespaced form of ‘app.path:path/to/template’.
- __init__(*args, **kwargs)¶
- get_template_sources(template_name)¶
Return an Origin object pointing to an absolute path in each directory in template_dirs. For security reasons, if a path doesn’t lie inside one of the template_dirs it is excluded from the result set.