node ¤
BaseNode ¤
BaseNode(
nodelist: Optional[NodeList] = None,
node_id: Optional[str] = None,
args: Optional[List[Expression]] = None,
kwargs: Optional[RuntimeKwargs] = None,
)
Bases: Node
Shared behavior for our subclasses of Django's Node
Source code in src/django_components/node.py
get_node_children ¤
Get child Nodes from Node's nodelist atribute.
This function is taken from get_nodes_by_type
method of django.template.base.Node
.
Source code in src/django_components/node.py
get_template_for_include_node ¤
This snippet is taken directly from IncludeNode.render()
. Unfortunately the render logic doesn't separate out template loading logic from rendering, so we have to copy the method.
Source code in src/django_components/node.py
walk_nodelist ¤
walk_nodelist(nodes: NodeList, callback: Callable[[Node], Optional[str]], context: Optional[Context] = None) -> None
Recursively walk a NodeList, calling callback
for each Node.