Opened 18 years ago
Closed 17 years ago
#3649 closed (duplicate)
Better formatting of the label text in newforms
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
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: | no | UI/UX: | no |
Description
The current label text processing is quite hardcoded, and changing it requires patching forms.py 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)
Change History (5)
by , 18 years ago
Attachment: | forms_label_formatting.diff added |
---|
comment:1 by , 18 years ago
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 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:3 by , 18 years ago
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 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Changes to newforms forms.py