|Reported by:||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I did a short implementation of something I call as_labels for newforms. The reason is that I didn't like the three alternatives, as I think they're no good. Yes, they work, but in my opinion it's better not to wrap each label and input/textarea field in an HTML <p>, <ul> or <tr>. It makes styling the forms with CSS a lot easier too. I didn't take printing of errors into consideration, so implement it the way you want, but I think that a <p>%(error)s</p> might be the best way to do it. I know that this one requires auto_id for the labels to work, but that's basically required anyways, in my opinion.
def as_labels(self): "Returns this form rendered as proper HTML forms." return self._html_output(u'%(label)s %(field)s', u'%s', '', True)
I hope you take this into consideration, as I really missed this one when I first started using newforms :)