Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9486 closed (duplicate)

The goal is to make sure the required field's lable be bold

Reported by: tangc Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: 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 (last modified by Malcolm Tredinnick)

Here is the svn diff

Index: django/forms/forms.py
===================================================================
--- django/forms/forms.py       (revision 9084)
+++ django/forms/forms.py       (working copy)
@@ -155,7 +155,13 @@
                     if self.label_suffix:
                         if label[-1] not in ':?.!':
                             label += self.label_suffix
-                    label = bf.label_tag(label) or ''
+
+                    attrs = None
+                    if bf.field.required:
+                        attrs = {'class': 'required'}
+
+                    label = bf.label_tag(label, attrs) or ''
+
                 else:
                     label = ''
                 if field.help_text:

Attachments (1)

9486.diff (729 bytes ) - added by tangc 16 years ago.

Download all attachments as: .zip

Change History (5)

by tangc, 16 years ago

Attachment: 9486.diff added

comment:1 by Henk de Vries, 16 years ago

Hmm, I think you should check for form errors in the template and then style your label accordingly. IMHO this shouldn't be put into trunk simply because it forces a certain style onto the Django user.
What if he/she want his/her label to be a Pony when a field is required?

About your patch:
It hasn't got tests, check the contributing guidelines in the docs.

comment:2 by Malcolm Tredinnick, 16 years ago

Resolution: duplicate
Status: newclosed

Basically a duplicate of #3512 and #3515 (this is just one specialised case of those). One day we'll make a decision about how to handle those cases.

comment:3 by Malcolm Tredinnick, 16 years ago

Description: modified (diff)

(Edited description because, due to a Trac bug, it was messing up the formatting of the rest of the page.)

comment:4 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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