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.auto_id">Email subject:</label>
{{ form.subject }}
</div>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23690>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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.auto_id">Email subject:</label>
> {{ form.subject }}
> </div>
> }}}
New description:
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>
}}}
--
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:1>
* owner: nobody => nmundar
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:2>
Comment (by nmundar):
I've made a PR here: https://github.com/django/django/pull/3524
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:3>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/3524 PR #3524] LGTM.
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:4>
Comment (by Marc Tamlyn <marc.tamlyn@…>):
In [changeset:"d30a131119c34ba166ccb7b01bc6201caa6f0831"]:
{{{
#!CommitTicketReference repository=""
revision="d30a131119c34ba166ccb7b01bc6201caa6f0831"
Merge pull request #3524 from nmundar/ticket_23690
Fixed #23690 - fixed examples of manual rendering of form fields
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"48515ee1f7bec437544a0a958332483298f4028b"]:
{{{
#!CommitTicketReference repository=""
revision="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.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:5>
Comment (by Tim Graham <timograham@…>):
In [changeset:"b2534bfa7b3b4f9d5e6c4db48556d2ae6ba3b4a9"]:
{{{
#!CommitTicketReference repository=""
revision="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
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23690#comment:7>