Opened 7 years ago

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

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by arien

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to arien
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

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 7 years ago by arien

comment:2 Changed 7 years ago by arien

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

comment:3 Changed 7 years ago by gwilson

  • Resolution set to fixed
  • Status changed from assigned to closed

(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