Django:使用render_to_response并设置Cookie
目前,我正在使用 render_to_response(template_name, locals(), context-etc..)
现在尝试设置Cookie,我想知道是否可以使用render_to_response
。
我看到的所有示例都在使用HttpResponse
对象。他们像这样在响应对象中设置cookie
response = HttpResponseObject(html)
response.set_cookie("favorite_color",request.GET["favorite_color"])
return response
想知道是否可以使用设置cookie render_to_response
,以便继续使用locals()
谢谢。大卫。