SimpleBlockNode
This class represents a template node that handles block-level content by managing a list of child nodes. It extends the base node functionality to resolve arguments while automatically injecting the rendered content of its node list into the argument list. This allows for the seamless processing of nested template blocks within a custom tag's execution context.
Attributes
| Attribute | Type | Description |
|---|---|---|
| nodelist | django.template.NodeList | A collection of template nodes representing the block's content that is rendered and inserted into the resolved arguments. |
Constructor
Signature
def SimpleBlockNode(
nodelist: list,
*args: tuple,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| nodelist | list | The list of nodes to be associated with this block. |
| *args | tuple | Variable length argument list. |
| **kwargs | dict | Arbitrary keyword arguments. |
Signature
def SimpleBlockNode(
nodelist: [NodeList](../base/nodelist.md?sid=django_template_base_nodelist),
*args: tuple,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| nodelist | [NodeList](../base/nodelist.md?sid=django_template_base_nodelist) | A collection of template nodes to be rendered as the block's content |
| *args | tuple | Variable positional arguments passed to the parent SimpleNode constructor |
| **kwargs | dict | Variable keyword arguments passed to the parent SimpleNode constructor |
Methods
get_resolved_arguments()
@classmethod
def get_resolved_arguments(
context: [Context](../context/context.md?sid=django_template_context_context)
) - > tuple
Resolves the tag's arguments from the context and inserts the rendered content of the block's nodelist into the argument list.
Parameters
| Name | Type | Description |
|---|---|---|
| context | [Context](../context/context.md?sid=django_template_context_context) | The template context used to resolve variables and render the internal nodelist |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the list of resolved positional arguments and a dictionary of resolved keyword arguments, with the rendered block content included |