as_p()

<dl class="method"> <dt style="font&#45;family&#58;Roboto&#44; Corbel&#44; Avenir&#44; &#39;Lucida Grande&#39;&#44; &#39;Lucida Sans&#39;&#44; sans&#45;serif&#59;"> <tt class="descclassname" style="font&#45;family&#58;&#39;Fira Mono&#39;&#44; Consolas&#44; Menlo&#44; Monaco&#44; &#39;Courier New&#39;&#44; Courier&#44; monospace&#59;line&#45;height&#58;14px&#59;color&#58;rgb&#40;12&#44;75&#44;51&#41;&#59;font&#45;size&#58;1em&#59;">Form.</tt> <tt class="descname" style="font&#45;family&#58;&#39;Fira Mono&#39;&#44; Consolas&#44; Menlo&#44; Monaco&#44; &#39;Courier New&#39;&#44; Courier&#44; monospace&#59;line&#45;height&#58;14px&#59;color&#58;rgb&#40;12&#44;75&#44;51&#41;&#59;font&#45;size&#58;1em&#59;">as_p</tt>() </dt> </dl>

<tt class="docutils literal" style="font&#45;family&#58;&#39;Fira Mono&#39;&#44; Consolas&#44; Menlo&#44; Monaco&#44; &#39;Courier New&#39;&#44; Courier&#44; monospace&#59;line&#45;height&#58;14px&#59;color&#58;rgb&#40;12&#44;75&#44;51&#41;&#59;font&#45;size&#58;1em&#59;font&#45;weight&#58;700&#59;">as_p()</tt> 渲染表单为一系列的<tt class="docutils literal" style="font&#45;family&#58;&#39;Fira Mono&#39;&#44; Consolas&#44; Menlo&#44; Monaco&#44; &#39;Courier New&#39;&#44; Courier&#44; monospace&#59;line&#45;height&#58;14px&#59;color&#58;rgb&#40;12&#44;75&#44;51&#41;&#59;font&#45;size&#58;1em&#59;font&#45;weight&#58;700&#59;"><p></tt> 标签,每个<tt class="docutils literal" style="font&#45;family&#58;&#39;Fira Mono&#39;&#44; Consolas&#44; Menlo&#44; Monaco&#44; &#39;Courier New&#39;&#44; Courier&#44; monospace&#59;line&#45;height&#58;14px&#59;color&#58;rgb&#40;12&#44;75&#44;51&#41;&#59;font&#45;size&#58;1em&#59;font&#45;weight&#58;700&#59;"><p></tt> 标签包含一个字段:

>>> f = ContactForm()
>>> f.as_p()
'<p><label for="id_subject">Subject:</label> <input id="id_subject" type="text" name="subject" maxlength="100" /></p>\n<p><label for="id_message">Message:</label> <input type="text" name="message" id="id_message" /></p>\n<p><label for="id_sender">Sender:</label> <input type="text" name="sender" id="id_sender" /></p>\n<p><label for="id_cc_myself">Cc myself:</label> <input type="checkbox" name="cc_myself" id="id_cc_myself" /></p>'
>>> print(f.as_p())
<p><label for="id_subject">Subject:</label> <input id="id_subject" type="text" name="subject" maxlength="100" /></p>
<p><label for="id_message">Message:</label> <input type="text" name="message" id="id_message" /></p>
<p><label for="id_sender">Sender:</label> <input type="email" name="sender" id="id_sender" /></p>
<p><label for="id_cc_myself">Cc myself:</label> <input type="checkbox" name="cc_myself" id="id_cc_myself" /></p>
将表单渲染为p标签