render_to_string
Load a template and render it with a context. Return a string.
template_name may be a string or a list of strings.
def render_to_string(
template_name: string|list,
context: dict = None,
request: HttpRequest = None,
using: string = None
) - > string
Load a template and render it with a context. Return a string.
Parameters
| Name | Type | Description |
|---|---|---|
| template_name | `string | list` |
| context | dict = None | A dictionary of values to be used as variables within the template during rendering. |
| request | HttpRequest = None | An optional current request object used to provide additional context processors. |
| using | string = None | The name of the specific template engine backend to use for loading the template. |
Returns
| Type | Description |
|---|---|
string | The rendered content of the template as a string. |