Skip to main content

render

Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.

def render(
request: HttpRequest,
template_name: str|list,
context: dict,
content_type: str,
status: int,
using: str
) - > HttpResponse

Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.

Parameters

NameTypeDescription
requestHttpRequestThe request object used to generate this response, which is passed to the template engine to provide context like CSRF tokens.
template_name`strlist`
contextdictA dictionary of values to add to the template context; defaults to an empty dictionary if not provided.
content_typestrThe MIME type to use for the resulting document, such as "text/html".
statusintThe HTTP status code for the response, such as 200 or 404.
usingstrThe name of a template engine to use for loading the template.

Returns

TypeDescription
HttpResponseAn HttpResponse instance containing the rendered template content with the specified status and content type.