Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3124 closed enhancement (wontfix)

[newforms] as_labels

Reported by: jesper@… Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 :)

Change History (2)

comment:1 by mail.orsus@…, 18 years ago

Infact, this should be the standard, but without the label's if auto_id is not set. And if you for some unsemantic reason need you form to be a table, you specify that by as_table.

comment:2 by Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: newclosed

Wontfix -- let's cap the default form output to the three choices we already have.

Note: See TracTickets for help on using tickets.
Back to Top