Opened 9 years ago

Closed 9 years ago

#5502 closed (duplicate)

Removing the automatic colon from newforms' _html_output

Reported by: anonymous Owned by: Vincent Foley
Component: Forms Version: master
Severity: Keywords: newforms colon
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The _html_output() method automatically adds a colon at the end of a field's label if the label name does not end with a punctuation symbol. I move to completely remove this behavior and let the programmer choose if he wants a colon or not by specifying it him/herself in his form definition. Django should not make presentation decisions for the user.

Here is the code in question, it's in django/newforms/forms.py on line 132 in r6345

# Only add a colon if the label does not end in punctuation.
if label[-1] not in ':?.!':
    label += ':'

Attachments (1)

label_colon_removal.patch (90.3 KB) - added by Vincent Foley 9 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 9 years ago by Vincent Foley

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Vincent Foley
Patch needs improvement: unset
Status: newassigned

Changed 9 years ago by Vincent Foley

Attachment: label_colon_removal.patch added

comment:2 Changed 9 years ago by Vincent Foley

Has patch: set

I've added a (rather large) patch to fix the issue. The patch remove the three lines previously mentioned from forms.py and the rest of the patch is to fix the large suite of unit tests.

comment:3 Changed 9 years ago by Vincent Foley

Resolution: duplicate
Status: assignedclosed

Dupe. See #4975

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