【发布时间】:2014-10-30 14:19:56
【问题描述】:
我有这样的功能(视图)
def index(request):
return render_to_response('index.html', context_instance=RequestContext(request))
只想写
return render_to_response('index.html')
我还想传递额外的变量来查看
return render_to_response('cart.html', {'key': value})
我需要 RequestContext 的主要原因是我有上下文处理器功能,可以为我设置额外的变量。我怎样才能做到这一点,或者有不同的方法来做这样的事情?
【问题讨论】:
标签: python django templates httprequest django-context