From 0a4c2033237bef19ecad9f7ac4422b20e56c1f89 Mon Sep 17 00:00:00 2001 From: Dan Poirier Date: Wed, 27 Nov 2013 13:11:23 -0500 Subject: [PATCH] Document how to use Jingo when template is in a string --- docs/index.rst | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 0ac704c..a7cf88f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -39,8 +39,24 @@ your view the same way you'd render Django templates:: .. note:: - Not only does ``django.shorcuts.render`` work, but so does any method that - Django provides to render templates. + Not only does ``django.shortcuts.render`` work, but so does any method that + Django provides to render templates from files. + +If you're using Django's low-level :class:`Template` +class with a literal string, e.g.:: + + from django.templates import Template + + t = Template('template string') + +then you'll need to change that code slightly, to:: + + from jingo import env + + t = env.from_string('template_string') + +and then the template will be rendered with all the same features that Jingo +provides when rendering template files. .. _settings: