【发布时间】:2013-11-27 07:34:02
【问题描述】:
考虑一下这个 new-food.html:
<form>
<h2>Food Name</h2>
<input type="text" name="food" value="%(foodname)s">
<h2>Sides:<h2>
<input type="checkbox" name="sides" value="with_salad"> With Salad
<input type="checkbox" name="sides" value="with_fries"> With Fries
<input type="submit">
</form>
提交时,它将创建一个 food 实体,其中保存了这些项目 ['apple', 'mango']。当我们想要编辑这个实体时会发生什么? %(foodname)s 会保留Food Name 文本字段,但是我们如何保留页面上传的checkbox 字段,像这样:
<input type="checkbox" name="sides" value="with_fries" checked> With Fries
【问题讨论】:
标签: python forms google-app-engine checkbox app-engine-ndb