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
| Attribute | Type | Description |
|---|---|---|
| func | callable | The decorated function that will be executed by the tag helper node. |
| takes_context | boolean | A boolean flag indicating whether the template context should be passed as the first argument to the decorated function. |
| args | list | A list of template variables representing the positional arguments to be resolved and passed to the function. |
| kwargs | dict | A 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
| Name | Type | Description |
|---|---|---|
| func | callable | The decorated function to be executed by the node. |
| takes_context | boolean | A flag indicating whether the function expects the template context as its first argument. |
| args | list | A list of positional arguments to be resolved and passed to the function. |
| kwargs | dict | A 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
| Name | Type | Description |
|---|---|---|
| context | django.template.Context | The template context used to resolve variable instances into their actual values. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing a list of resolved positional arguments and a dictionary of resolved keyword arguments. |