Opened 10 years ago

Last modified 10 years ago

#23690 closed Cleanup/optimization

Docs for Rendering fields manually <label for="...."> showing static rather than dynamic code — at Version 1

Reported by: awidgery Owned by: nobody
Component: Documentation Version: 1.7
Severity: Normal Keywords:
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 (last modified by Tim Graham)

See here:

https://docs.djangoproject.com/en/1.7/topics/forms/#rendering-fields-manually

<div class="fieldWrapper">
    {{ form.subject.errors }}
    <label for="id_subject">Email subject:</label>
    {{ form.subject }}
</div>

Wouldn't it be better to show:

<div class="fieldWrapper">
    {{ form.subject.errors }}
    <label for="{{ form.subject.id_for_label }}">Email subject:</label>
    {{ form.subject }}
</div>

Change History (1)

comment:1 by Tim Graham, 10 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

That seems fine to me. In the ticket you original had auto_id, but I think you meant id_for_label so I edited the description. We might also want to note the alternative of {{ field.label_tag }} for that entire line, presuming you have made all the customizations on the form.

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