#18134: please add Filed.label_tag_with_suffix method -------------------------------------+------------------------------------- Reporter: Evil Clay | Owner: nobody <clay.evil@…> | Status: reopened Type: Uncategorized | Version: 1.4 Component: Uncategorized | Resolution: Severity: Normal | Triage Stage: Keywords: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Evil Clay <clay.evil@…>):
* status: closed => reopened * resolution: invalid => Comment: I'm sorry, my knowledge of djnago is limited unlike yours, i didn't know that this method exists on more places. I'm referring to https://docs.djangoproject.com/en/1.4/topics/forms/ (Customizing the form template) {{ field.label_tag }} The field's label wrapped in the appropriate HTML <label> tag, e.g. <label for="id_email">Email address</label> and also to Ticket #6877 where it is explained why the field.label_tag doesn't respect the form's label_suffix which i understand. The problem is that if i use in my project in as many pages as i can the {{ form.as_p }} to respect the DRY, but in some cases you have to add some HTML code in the form, so you have to manually render the form usually like this: <p> {{ form.name.errors }}[[BR]] {{ form.name.label_tag }}{{ form.name }}<span class="helptext">{{ form.name.help_text }}</span> </p> which would render the form without the label_suffix (i.e. without the ":" in the label). so you would have to do it like this: <p> {{ form.name.errors }}[[BR]] <label for="id_name ">{{ form.name.label }}:</label>{{ form.name }}<span class="helptext">{{ form.name.help_text }}</span> </p> which forces you to dirty write the "id_name" where the "id_" is as far as i know configurable in forms so this would be an incorrect way of doing it. my proposal is to add {{ form.name.label_tag_with_suffix }} method which would solve the problem. -- Ticket URL: <https://code.djangoproject.com/ticket/18134#comment:2> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.