Skip to content

render_block_to_string expects context to be "Context | None" instead of dict #57

@ma11011s

Description

@ma11011s

In the readme this example code is given:

print(render_block_to_string('test3.html', 'block3', {'variable': 'test'}))

but the code defines that context is not a dict but Optional[Context] = None:

def render_block_to_string(
    template_name: Union[str, Tuple[str], List[str]],
    block_name: str,
    context: Optional[Context] = None,
    request: Optional[HttpRequest] = None,
) -> str:

We could provide a Context object but i don't think that was intended to do :

from django.template import Context
print(render_block_to_string('test3.html', 'block3', Context({'variable': 'test'})))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions