2013-04-10 103 views

回答

1

你可以在模板中使用django的自动as_p函数,或者你可以手动编写你的模板(以更多的控制它的属性)。

对于自动您需要这在你的模板:

{{ form.as_p }} 

对于手动你应该使用这样的事情:

<input type="checkbox" id="livereport" name="livereport" {% if form.livereport.value %}checked="checked"{% endif %}> 
<label for="livereport">Show live report</label> 
+0

我做了 “{{form.as_p}}” 这不是渲染输出 – user2086641 2013-04-10 21:08:08

+0

@ user2086641如果您将'form'作为'render'函数的参数传递,它将起作用。看看这个页面https://docs.djangoproject.com/en/dev/topics/forms/并检查示例。 – MostafaR 2013-04-10 21:20:43

+0

将通过并执行 – user2086641 2013-04-10 21:30:59

相关问题