Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3124 closed enhancement (wontfix)

[newforms] as_labels

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

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 Changed 9 years ago by mail.orsus@…

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 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

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