Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20805 closed Bug (fixed)

form.label_suffix colon on admin checkboxes

Reported by: Collin Anderson Owned by: Tim Graham
Component: contrib.admin Version: 1.6-beta-1
Severity: Release blocker Keywords:
Cc: Collin Anderson Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django1.5: http://snag.gy/JyMxI.jpg
django1.6b1: http://snag.gy/ilUNM.jpg

This is regression was introduced by #18134 584bd14dcfdee9585fec7794d53ce120ea73d0bc.

Here is the admin's algorithm for deciding when to add the colon:
https://github.com/django/django/blob/master/django/contrib/admin/helpers.py#L126
After the admin sets up the label it wants, it calls field.label_tag which then adds the colon back.

Attachments (2)

20805.diff (3.5 KB ) - added by Tim Graham 11 years ago.
20805.2.diff (6.8 KB ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Tim Graham, 11 years ago

Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

by Tim Graham, 11 years ago

Attachment: 20805.diff added

comment:2 by Tim Graham, 11 years ago

Has patch: set
Needs documentation: set

Adding a proposal to add an include_label_suffix kwarg to label_tag. Will update the docs if this looks reasonable.

by Tim Graham, 11 years ago

Attachment: 20805.2.diff added

comment:3 by Tim Graham, 11 years ago

Needs documentation: unset

Added a more general solution that allows overriding label_suffix at the field level.

comment:4 by Claude Paroz, 11 years ago

The patch is rather good, but I'm afraid it doesn't cover the use case when you call label_tag in a template to render a checkbox field:

{{ form.cb_field }} {{ form.cb_field.label_tag }}

No better solution to propose yet...

comment:5 by Collin Anderson, 11 years ago

...another case where calling methods with arguments would be quite nice...

comment:6 by Tim Graham, 11 years ago

We could recommend writing a custom filter for that case.

comment:7 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 8676318d2dae9a570d2314e4e6da8c00aaf2e2a0:

Fixed #20805 -- Removed an extra colon beside checkboxes in the admin.

Thanks CollinAnderson for the report.

comment:8 by Tim Graham <timograham@…>, 11 years ago

In dbbd2b1272e5a3ce7ab4b39b9a74f4ea725b104f:

[1.6.x] Fixed #20805 -- Removed an extra colon beside checkboxes in the admin.

Thanks CollinAnderson for the report.

Backport of 8676318d2d from master

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