Django获取checkbox勾选框的值(转载)

<form action="" method="POST">
    <input type="checkbox" value="1" name="check_box_list"/>1
    <input type="checkbox" value="2" name="check_box_list"/>2
    <input type="checkbox" value="3" name="check_box_list"/>3
    <input type="checkbox" value="4" name="check_box_list"/>4
    <input type="submit" value="提交">
</form>

 

#通过request.REQUEST.getlist取到list形式的提交结果
def getresult(request):
    check_box_list = request.REQUEST.getlist("check_box_list")

 

posted @ 2017-06-14 15:18  leonardchen  阅读(6147)  评论(0编辑  收藏  举报