Django Book 翻译
菜单>:
TOC
返回
原文:
In Chapter 4, we introduced the ``render_to_response()`` shortcut, which saves you from having to call ``loader.get_template()`` , then create a ``Context`` , then call the ``render()`` method on the template. In order to demonstrate the lower-level workings of context processors, the above examples didnt use ``render_to_response()`` , . But its possible and preferable to use context processors with ``render_to_response()`` . Do this with the ``context_instance`` argument, like so:
翻译:
在第四章,我们介绍了 ``render_to_response()`` 这个快捷方式,它可以省掉调用 ``loader.get_template()`` ,然后创建一个 ``Context`` 对象,最后再调用模板对象的 ``render()`` 方法。为了讲解context处理器底层是如何工作的,在上面的例子中我们没有使用 ``render_to_response()`` 。但是建议选择 ``render_to_response()`` 作为context的处理器。像这样,使用 ``context_instance`` 参数:
备注:
译者: