<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # POST屬性 * QueryDict類型的對象 * 包含post請求方式的所有參數 * 與form表單中的控件對應 * 表單中的那些控件會被提交 * 控件要有name屬性,則name屬性的值為鍵,value屬性的值為鍵,構成鍵值對提交 * 對于CheckBox控,name屬性一樣為一組,當控件被選中后會被提交,存在一鍵多值的情況 * 值是可變的 * 定義視圖login ```text def login(request): return render(request,'myapp/login.html') ``` * 配置路由url ```text url(r'^login/$',views.login), ``` * 創建模板login.html ```text <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form method="post" action="/main/"> 姓名: <input type="text" name="name"/><br /> 密碼: <input type="password" name="pwd"/><br /> 性別: <input type="radio" name="sex" value="1" />男 <input type="radio" name="sex" value="0"/>女<br /> 愛好: <input type="checkbox" name="hobby" value="c/c++"/>c/c++ <input type="checkbox" name="hobby" value="python"/>python <input type="checkbox" name="hobby" value="java"/>java <input type="checkbox" name="hobby" value="C#"/>C# <input type="submit" value="value"/> </form> </body> </html> ``` * 創建視圖main接收請求的數據 ```text def main(request): name = request.POST['name'] password = request.POST['pwd'] sex = request.POST['sex'] hobby = request.POST.getlist('hobby') context = {'name':name,'password':password,'sex':sex,'hobby':hobby} return render(request,'myapp/main.html',context) ``` * 配置路由urls.py ```text url(r'^main/$',views.main), ``` * 創建模板main.html ```text <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> {{ name }} {{ password }} {{ sex }} {{ hobby }} </body> </html> ``` * 注意:使用表單提交,注釋掉settings.py中的中間件crsf ```text MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', # 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看