summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-03-31 08:31:03 -0400
committerTim Graham <timograham@gmail.com>2016-03-31 08:31:55 -0400
commita65fc6df891ab449e9c24160f6f6a1d6d2ccb282 (patch)
treeda50451c4b2883672b039e8eddda7ebb035c022f /docs
parent49f95cc0a0167e91fd0f6987428905911bff076c (diff)
Fixed #26410 -- Added a docs example for loader.render_to_string().
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/templates.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt
index 1d2f734bb8..197ffc1111 100644
--- a/docs/topics/templates.txt
+++ b/docs/topics/templates.txt
@@ -256,6 +256,11 @@ templates, Django provides a shortcut function which automates the process.
An optional :class:`~django.http.HttpRequest` that will be available
during the template's rendering process.
+ 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.