Checkbox 多重选择列表 Template

>>> check_box.html

<html>
 <body>
  <p>Testing Project for OSU/CSD</p>
  <form action="" method="POST"> 
   {%for item in options%}
    <input type="checkbox" value="1" name="check_box_list"/>{{item}}
    <br>
   {%endfor%}
   <input type="submit" value="提交"/> 
  </form> 
 </body>
</html>

>>> views.py

def checkList(request):
  ...
  t = get_template("check_box.html")
  someList = getSomeList()
  html = t.render(Context({"options": someList}))
  return HttpResponse(html)

 

posted on 2013-04-06 22:49  0x9801  阅读(144)  评论(0)    收藏  举报

导航