class documentation

class Library:

View In Hierarchy

A class for registering template tags and filters. Compiled filter and template tag functions are stored in the filters and tags attributes. The filter, simple_tag, and inclusion_tag methods provide a convenient way to register callables as tags.
Method __init__ Undocumented
Method filter Register a callable as a template filter. Example:
Method filter​_function Undocumented
Method inclusion​_tag Register a callable as an inclusion tag:
Method simple​_tag Register a callable as a compiled template tag. Example:
Method tag Undocumented
Method tag​_function Undocumented
Instance Variable filters Undocumented
Instance Variable tags Undocumented
def __init__(self):

Undocumented

def filter(self, name=None, filter_func=None, **flags):

Register a callable as a template filter. Example:

@register.filter def lower(value):

return value.lower()
def filter_function(self, func, **flags):

Undocumented

def inclusion_tag(self, filename, func=None, takes_context=None, name=None):

Register a callable as an inclusion tag:

@register.inclusion_tag('results.html') def show_results(poll):

choices = poll.choice_set.all() return {'choices': choices}
def simple_tag(self, func=None, takes_context=None, name=None):

Register a callable as a compiled template tag. Example:

@register.simple_tag def hello(*args, **kwargs):

return 'world'
def tag(self, name=None, compile_function=None):

Undocumented

def tag_function(self, func):

Undocumented

filters: dict =

Undocumented

tags: dict =

Undocumented