zoukankan      html  css  js  c++  java
  • why request.path return None?

       in django, sometimes you want to pass value of current page path , you will do this follows:

      a. <form action="./?next={{request.path}}" method="post">...</form>

      b.<form action="" method="post">

       <input type="hidden" name="next" value="{{request.path}}"/>

       </form>

      c.<a href="xxx/?next={{request.path}}">xx</a>

      however, perheps you find out that the value of 'next' is None in views.py. so you could think that request is None. But my code is that:

    def index(request):
        xxxx
        return render_to_response('index.html',{},RequestContext(request))

      through my test. if you should apparently pass request, it will work ok. now the modified code is as follow:

    def index(request):
        xxxx
        return render_to_response('index.html',{'request':request},RequestContext(request))

      and i don't know why. if anyone konws,pleasure tell me the answer.



  • 相关阅读:
    bzoj3622: 已经没有什么好害怕的了
    BSGS
    LOJ#2320 生成树计数
    ??? cliquers
    生成函数
    洛谷P5206 数树
    01分数规划
    差分约束系统
    51nod1238 最小公倍数之和 V3
    51nod1237 最大公约数之和 V3
  • 原文地址:https://www.cnblogs.com/slider/p/2980992.html
Copyright © 2011-2022 走看看