Django Book 翻译
菜单>:
TOC
返回
原文:
* Weve changed the four view functions to use ``RequestContext`` instead of ``Context`` . There are two differences in how the context is constructed. One, ``RequestContext`` requires the first argument to be an ``HttpRequest`` object the one that was passed into the view function in the first place (``request`` ). Two, ``RequestContext`` takes an optional ``processors`` argument, which is a list or tuple of context processor functions to use. Here, we pass in ``custom_proc`` , the custom processor we defined above.
翻译:
* 我们在这四个视图函数中用 ``RequestContext`` 代替了 ``Context`` 。在context对象的构建上有两个不同点。一, ``RequestContext`` 的第一个参数需要传递一个 ``HttpRequest`` 对象,就是传递给视图函数的第一个参数( ``request`` )。二, ``RequestContext`` 有一个可选的参数 ``processors`` ,这是一个包含context处理器函数的list或者tuple。在这里,我们传递了我们之前定义的函数 ``curstom_proc`` 。
备注:
译者: