provide - Django-Components" > provide - Django-Components" >
Skip to content

provide ¤

ProvideNode ¤

ProvideNode(nodelist: NodeList, trace_id: str, node_id: Optional[str] = None, kwargs: Optional[RuntimeKwargs] = None)

Bases: BaseNode

Implementation of the {% provide %} tag. For more info see Component.inject.

Source code in src/django_components/provide.py
def __init__(
    self,
    nodelist: NodeList,
    trace_id: str,
    node_id: Optional[str] = None,
    kwargs: Optional[RuntimeKwargs] = None,
):
    super().__init__(nodelist=nodelist, args=None, kwargs=kwargs, node_id=node_id)

    self.nodelist = nodelist
    self.node_id = node_id or gen_id()
    self.trace_id = trace_id
    self.kwargs = kwargs or RuntimeKwargs({})