Jump to >

djblets.template.loaders.namespaced_app_dirs

class Loader(*args, **kwargs)[source]

Bases: django.template.loaders.app_directories.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)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

get_template_sources(template_name, template_dirs=None)[source]

Returns the absolute paths to “template_name”, when appended to each directory in “template_dirs”. Any paths that don’t lie inside one of the template dirs are excluded from the result set, for security reasons.