template.Engine.select_template()

Engine.select_template(self, template_name_list) [source] Like get_template(), except it takes a list of names and returns the first template that was found.

template.Engine.get_template()

Engine.get_template(template_name) [source] Loads a template with the given name, compiles it and returns a Template object.

template.Engine.from_string()

Engine.from_string(template_code) [source] Compiles the given template code and returns a Template object.

template.Engine

class Engine(dirs=None, app_dirs=False, context_processors=None, debug=False, loaders=None, string_if_invalid='', file_charset='utf-8', libraries=None, builtins=None, autoescape=True) [source] When instantiating an Engine all arguments must be passed as keyword arguments: dirs is a list of directories where the engine should look for template source files. It is used to configure filesystem.Loader. It defaults to an empty list. app_dirs only affects the default value of loaders. See below

template.defaultfilters.stringfilter()

django.template.defaultfilters.stringfilter() If you’re writing a template filter that only expects a string as the first argument, you should use the decorator stringfilter. This will convert an object to its string value before being passed to your function: from django import template from django.template.defaultfilters import stringfilter register = template.Library() @register.filter @stringfilter def lower(value): return value.lower() This way, you’ll be able to pass, say, an in

template.context_processors.tz()

tz() [source] If this processor is enabled, every RequestContext will contain a variable TIME_ZONE, providing the name of the currently active time zone.

template.context_processors.static()

static() [source] If this processor is enabled, every RequestContext will contain a variable STATIC_URL, providing the value of the STATIC_URL setting.

template.context_processors.debug()

debug() [source] If this processor is enabled, every RequestContext will contain these two variables – but only if your DEBUG setting is set to True and the request’s IP address (request.META['REMOTE_ADDR']) is in the INTERNAL_IPS setting: debug – True. You can use this in templates to test whether you’re in DEBUG mode. sql_queries – A list of {'sql': ..., 'time': ...} dictionaries, representing every SQL query that has happened so far during the request and how long it took. The list is i

template.Context.update()

Context.update(other_dict) [source] In addition to push() and pop(), the Context object also defines an update() method. This works like push() but takes a dictionary as an argument and pushes that dictionary onto the stack instead of an empty one. >>> c = Context() >>> c['foo'] = 'first level' >>> c.update({'foo': 'updated'}) {'foo': 'updated'} >>> c['foo'] 'updated' >>> c.pop() {'foo': 'updated'} >>> c['foo'] 'first level' Like push(),

template.Context.setdefault()

Context.setdefault(key, default=None) New in Django 1.9. If key is in the context, returns its value. Otherwise inserts key with a value of default and returns default.