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.pop()

Context.pop()

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.

template.Context.flatten()

Context.flatten() Using flatten() method you can get whole Context stack as one dictionary including builtin variables. >>> c = Context() >>> c['foo'] = 'first level' >>> c.update({'bar': 'second level'}) {'bar': 'second level'} >>> c.flatten() {'True': True, 'None': None, 'foo': 'first level', 'False': False, 'bar': 'second level'} A flatten() method is also internally used to make Context objects comparable. >>> c1 = Context() >>> c1['

template.base.Origin

class Origin [source] name The path to the template as returned by the template loader. For loaders that read from the file system, this is the full path to the template. If the template is instantiated directly rather than through a template loader, this is a string value of <unknown_source>. template_name The relative path to the template as passed into the template loader. If the template is instantiated directly rather than through a template loader, this is None.

template.base.Origin.name

name The path to the template as returned by the template loader. For loaders that read from the file system, this is the full path to the template. If the template is instantiated directly rather than through a template loader, this is a string value of <unknown_source>.

template.Context

class Context(dict_=None) [source] This class lives at django.template.Context. The constructor takes two optional arguments: A dictionary mapping variable names to variable values. The name of the current application. This application name is used to help resolve namespaced URLs. If you’re not using namespaced URLs, you can ignore this argument. For details, see Playing with Context objects below.

template.backends.jinja2.Jinja2

class Jinja2 [source] Requires Jinja2 to be installed: $ pip install Jinja2 Set BACKEND to 'django.template.backends.jinja2.Jinja2' to configure a Jinja2 engine. When APP_DIRS is True, Jinja2 engines look for templates in the jinja2 subdirectory of installed applications. The most important entry in OPTIONS is 'environment'. It’s a dotted Python path to a callable returning a Jinja2 environment. It defaults to 'jinja2.Environment'. Django invokes that callable and passes other options as ke

template.base.Origin.template_name

template_name The relative path to the template as passed into the template loader. If the template is instantiated directly rather than through a template loader, this is None.

template.backends.django.DjangoTemplates

class DjangoTemplates [source] Set BACKEND to 'django.template.backends.django.DjangoTemplates' to configure a Django template engine. When APP_DIRS is True, DjangoTemplates engines look for templates in the templates subdirectory of installed applications. This generic name was kept for backwards-compatibility. DjangoTemplates engines accept the following OPTIONS: 'autoescape': a boolean that controls whether HTML autoescaping is enabled. It defaults to True. Warning Only set it to False