Opened 17 years ago

Closed 17 years ago

#6164 closed (fixed)

form generation sample code in docs prints label twice

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

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 17 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by arien, 17 years ago

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>

by arien, 17 years ago

Attachment: 6164.diff added

comment:2 by arien, 17 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:3 by Gary Wilson, 17 years ago

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