Django Book 翻译
菜单>:
TOC
返回
原文:
Because its such a common idiom to load a template, fill a ``Context`` , and return an ``HttpResponse`` object with the result of the rendered template, Django provides a shortcut that lets you do those things in one line of code. This shortcut is a function called ``render_to_response()`` , which lives in the module ``django.shortcuts`` . Most of the time, youll be using ``render_to_response()`` rather than loading templates and creating ``Context`` and ``HttpResponse`` objects manually.
翻译:
由于加载模板、填充 ``context`` 、将经解析的模板结果返回为 ``HttpResponse`` 对象这一系列操作实在太常用了,Django 提供了一条仅用一行代码就完成所有这些工作的捷径。该捷径就是位于 ``django.shortcuts`` 模块中名为 ``render_to_response()`` 的函数。大多数时候,你将使用 ``render_to_response()`` ,而不是手动加载模板、创建 ``Context`` 和 ``HttpResponse`` 对象。
备注:
译者: