0

我有 2 种付款方式和 3 种产品。

我有一种选择产品和选择付款方式的表格:

<form action="/order-form/{{product.id}}" method="get">      
    <select name="producttype">
          <option value="type1">Select one of option</option>
          <option value="type1">Option 1</option>
          <option value="type2">Option 2</option>
          <option value="type3">Option 3</option>
    </select>

    <input type="radio" name="pay" value="bank" /> Bank <br/>
    <input type="radio" name="pay" value="paypal"/> PayPal
    <input type="submit" value="Next"  id="form_submit"/>
</form>

发送此表格后,我需要根据付款方式查看带有表格的下一个视图。怎么做?

4

1 回答 1

2
 def my_view(request):
     ...
     if request.method == "POST":
         payment_method =  request.POST.get("pay", None)
         product_type = request.POST.get("producttype", None)
         if payment_method == "bank":
             ...
         elif payment_method == "paypal":
             ...
于 2013-06-17T11:02:17.857 回答