diff options
| author | Tim Graham <timograham@gmail.com> | 2016-03-31 08:31:03 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-31 09:58:11 -0400 |
| commit | d58a324bea2df202bc09bd887f564c3f8e35b2ec (patch) | |
| tree | b8114fe37acb6b7545674c74d00be8b4e6e42724 | |
| parent | ed87af32662bf7a3829e679831e6e019b9d85112 (diff) | |
[1.9.x] Fixed #26410 -- Added a docs example for loader.render_to_string().
Backport of a65fc6df891ab449e9c24160f6f6a1d6d2ccb282 from master
| -rw-r--r-- | docs/topics/templates.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index 8cae601979..fb64f20c6e 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -309,6 +309,11 @@ templates, Django provides a shortcut function which automates the process. 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 :func:`render_to_string()` and feeds the result into an :class:`~django.http.HttpResponse` suitable for returning from a view. |
