module documentation

Undocumented

Constant BLOCK​_CONTEXT​_KEY Undocumented
Variable register Undocumented
Class ​Block​Context Undocumented
Class ​Block​Node Undocumented
Class ​Extends​Node No class docstring; 0/4 instance variable, 0/2 class variable, 1/5 method documented
Class ​Include​Node No class docstring; 0/3 instance variable, 0/1 class variable, 1/3 method documented
Function construct​_relative​_path Convert a relative path (starting with './' or '../') to the full template name based on the current_template_name.
Function do​_block Define a block that can be overridden by child templates.
Function do​_extends Signal that this template extends a parent template.
Function do​_include Load a template and render it with the current context. You can pass additional context using keyword arguments.
BLOCK_CONTEXT_KEY: str =

Undocumented

Value
'block_context'
register =

Undocumented

def construct_relative_path(current_template_name, relative_name):
Convert a relative path (starting with './' or '../') to the full template name based on the current_template_name.
@register.tag('block')
def do_block(parser, token):
Define a block that can be overridden by child templates.
@register.tag('extends')
def do_extends(parser, token):

Signal that this template extends a parent template.

This tag may be used in two ways: {% extends "base" %} (with quotes) uses the literal value "base" as the name of the parent template to extend, or {% extends variable %} uses the value of variable as either the name of the parent template to extend (if it evaluates to a string) or as the parent template itself (if it evaluates to a Template object).

@register.tag('include')
def do_include(parser, token):

Load a template and render it with the current context. You can pass additional context using keyword arguments.

Example:

{% include "foo/some_include" %}
{% include "foo/some_include" with bar="BAZZ!" baz="BING!" %}

Use the only argument to exclude the current context when rendering the included template:

{% include "foo/some_include" only %}
{% include "foo/some_include" with bar="1" only %}