Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23690 closed Cleanup/optimization (fixed)

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

Reported by: awidgery Owned by: Neven Munđar
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 (7)

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.

comment:2 by Neven Munđar, 10 years ago

Owner: changed from nobody to Neven Munđar
Status: newassigned

comment:4 by Berker Peksag, 10 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

PR #3524 LGTM.

comment:5 by nmundar <neven.mundar@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 48515ee1f7bec437544a0a958332483298f4028b:

Fixed #23690 - fixed examples of manual rendering of form fields

Documentation for rendering form fields manually is now updated to use fields id_for_label instead of hardcoded values with additional mention of label_tag for alternative generation of complete label tag.

comment:6 by Marc Tamlyn <marc.tamlyn@…>, 10 years ago

In d30a131119c34ba166ccb7b01bc6201caa6f0831:

Merge pull request #3524 from nmundar/ticket_23690

Fixed #23690 - fixed examples of manual rendering of form fields

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

In b2534bfa7b3b4f9d5e6c4db48556d2ae6ba3b4a9:

[1.7.x] Fixed #23690 - fixed examples of manual rendering of form fields

Documentation for rendering form fields manually is now updated to use fields id_for_label instead of hardcoded values with additional mention of label_tag for alternative generation of complete label tag.

Backport of 48515ee1f7bec437544a0a958332483298f4028b from master

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