Opened 11 years ago

Closed 11 years ago

#3649 closed (duplicate)

Better formatting of the label text in newforms

Reported by: Henrik Vendelbo <info@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: label output
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The current label text processing is quite hardcoded, and changing it requires patching or replacing it.

The default behaviour is to use a prettified version of the field name if no label is given and html_escape it, and append a ':'.

This behaviour is retained, but can be changed by supplying two functions to the Form constructor.

Attachments (1)

forms_label_formatting.diff (972 bytes) - added by info@… 11 years ago.
Changes to newforms

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by info@…

Attachment: forms_label_formatting.diff added

Changes to newforms

comment:1 Changed 11 years ago by info@…

I forgot to change the escape_label function to include the field as a parameter. This allows highlighting labels for required fields, which is quite common.

comment:2 Changed 11 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:3 Changed 11 years ago by anonymous

It would also be good to move the loop from the internal formatting function to the as_... functions, so it is possible to easily make custom renderers that print a subset of fields.

comment:4 Changed 11 years ago by James Bennett

Resolution: duplicate
Status: newclosed

Duplicate of #4975, which was fixed in [6352]; the label suffix is now configurable.

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