Opened 9 years ago

Closed 9 years ago

#6164 closed (fixed)

form generation sample code in docs prints label twice

Reported by: annacoder Owned by: arien
Component: Documentation Version: master
Severity: Keywords: newforms
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

in this part of the docs: http://www.djangoproject.com/documentation/newforms/#highlighting-required-fields-in-templates,
the following sample code,
{% for field in form %}

<dt>{{ field.label_tag }}{{ field.label }}{% if field.field.required %}*{% endif %}</dt>

prints the label twice

Attachments (1)

6164.diff (633 bytes) - added by arien 9 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 9 years ago by arien

Owner: changed from nobody to arien
Status: newassigned
Triage Stage: UnreviewedAccepted

The output contains lines like the following:

<dt><label for="id_subject">Subject</label>Subject*</dt>

I'll attach a patch so that it generates this instead:

<dt><label for="id_subject">Subject</label>*</dt>

Changed 9 years ago by arien

Attachment: 6164.diff added

comment:2 Changed 9 years ago by arien

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:3 Changed 9 years ago by Gary Wilson

Resolution: fixed
Status: assignedclosed

(In [6907]) Fixed #6164 -- field.label_tag already displays the label so don't display it again. Thanks, arien.

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