mirror of
https://github.com/django/django.git
synced 2025-07-20 01:29:11 +00:00
[1.9.x] Fixed #26410 -- Added a docs example for loader.render_to_string().
Backport of a65fc6df891ab449e9c24160f6f6a1d6d2ccb282 from master
This commit is contained in:
parent
ed87af3266
commit
d58a324bea
@ -309,6 +309,11 @@ templates, Django provides a shortcut function which automates the process.
|
|||||||
|
|
||||||
The ``request`` argument was added.
|
The ``request`` argument was added.
|
||||||
|
|
||||||
|
Usage example::
|
||||||
|
|
||||||
|
from django.template.loader import render_to_string
|
||||||
|
rendered = render_to_string('my_template.html', {'foo': 'bar'})
|
||||||
|
|
||||||
See also the :func:`~django.shortcuts.render()` shortcut which calls
|
See also the :func:`~django.shortcuts.render()` shortcut which calls
|
||||||
:func:`render_to_string()` and feeds the result into an
|
:func:`render_to_string()` and feeds the result into an
|
||||||
:class:`~django.http.HttpResponse` suitable for returning from a view.
|
:class:`~django.http.HttpResponse` suitable for returning from a view.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user