Skip to main content

TagHelperNode

Base class for tag helper nodes such as SimpleNode and InclusionNode. Manages the positional and keyword arguments to be passed to the decorated function.

Attributes

AttributeTypeDescription
funccallableThe decorated function that will be executed by the tag helper node.
takes_contextbooleanA boolean flag indicating whether the template context should be passed as the first argument to the decorated function.
argslistA list of template variables representing the positional arguments to be resolved and passed to the function.
kwargsdictA dictionary of template variables representing the keyword arguments to be resolved and passed to the function.

Constructor

Signature

def TagHelperNode(
func: callable,
takes_context: boolean,
args: list,
kwargs: dict
) - > null

Parameters

NameTypeDescription
funccallableThe decorated function to be executed by the node.
takes_contextbooleanA flag indicating whether the function expects the template context as its first argument.
argslistA list of positional arguments to be resolved and passed to the function.
kwargsdictA dictionary of keyword arguments to be resolved and passed to the function.

Methods


get_resolved_arguments()

@classmethod
def get_resolved_arguments(
context: django.template.Context
) - > tuple

Resolves the positional and keyword arguments against the provided context, optionally prepending the context itself if required by the underlying function.

Parameters

NameTypeDescription
contextdjango.template.ContextThe template context used to resolve variable instances into their actual values.

Returns

TypeDescription
tupleA tuple containing a list of resolved positional arguments and a dictionary of resolved keyword arguments.