开发者

Print request in template

 def test4(request):
   logging.debug(request)
   logging.debug(request.META['HTTP_REFERER'])
   return render_to_response('test2/test4.html', context_instance=RequestContext(request))

In the above code can request be printed in the test4.html and also the request.META['HTTP_REFERER'] i had tried

      <script>

        alert('{{request}}');开发者_运维百科    //prints empty
        alert('{{request.META.HTTP_REFERER}}');  //prints empty

      </script>


Have you added django.core.context_processors.request to your context processors setting? It's not enabled by default.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜