Skip to main content

select_template

Load and return a template for one of the given names.

Try names in order and return the first template found.

Raise TemplateDoesNotExist if no such template exists.

def select_template(
template_name_list: iterable,
using: string = None
) - > Template

Load and return a template for one of the given names. Try names in order and return the first template found. Raise TemplateDoesNotExist if no such template exists.

Parameters

NameTypeDescription
template_name_listiterableAn iterable of template names to search for in order; raises TypeError if a single string is passed instead of an iterable.
usingstring = NoneThe name of the specific template engine to use for loading; if None, all configured engines are searched.

Returns

TypeDescription
TemplateThe first Template object successfully loaded from the provided list of names.