Opened 18 years ago
Closed 18 years ago
#3122 closed defect (invalid)
newforms: {{ form.field.label }} should output <label> when auto_id present
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
class MyForm(Form): field = CharField(label="Test") def myview(request): form = MyForm(auto_id="id_%s") return render_to_response("test.html", {"form": form}) # test.html {{ form.field.label }}
yields "Test". As auto_id is set, I would expect this to output <label for="id_field">Test:</label>, as form.as_table and other functions already do. If you don't want the <label>, you won't be using auto_id anyway.
Note:
See TracTickets
for help on using tickets.
Nevermind, marking invalid. This can already be done, just not as the default behavior as I expected. In case anyone ends up here from searching, you can already do this using
Or in your template as {{ form.field.label_tag }}.