#23690: Docs for Rendering fields manually <label for="...."> showing static rather than dynamic code --------------------------------------+------------------------------------ Reporter: awidgery | Owner: nobody Type: Cleanup/optimization | Status: new Component: Documentation | Version: 1.7 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------ Changes (by timgraham):
* 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> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.b2b9804ee47949b6d6e65c4bb1e78c94%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.