import django newforms def as_p self Returns this form rendered as HTM

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import django.newforms
def as_p(self):
"""
Returns this form rendered as HTML <p>s.
This is modified version of original as_p. It wraps help_text into
<div class="help-text"></span>
"""
return self._html_output(u'<p>%(label)s %(field)s%(help_text)s</p>', u'%s', '</p>',
u' <span class="help-text">%s</span>', True)
# Oh, shit! That is .... mmmmmonkey patching!
django.newforms.as_p = as_p