Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
webapp2 如何从 jinja2 模板中获取复选框值,并且名称相同?数据结构是 Dict 吗?怎样才能得到它并通过它?
html模板:
...
{% for tablename in tablenames %} <input type = "checkbox" name = "tn">{{tablename}} {% endfor %}
主要.py:
tn = self.request.get('tn')
谢谢你们 : )
如何获取复选框值并将其传递给 tn ?
我认为您的模板应该是...
{% for tablename in tablenames %} <input type="checkbox" name="tn" value="{{ tablename }}" /> {% endfor %}
并且代码应该是(我相信在 WebApp2中.GET也可以处理vars):.POST
.GET
.POST
tn = self.request.GET['tn']