Opened 17 years ago
Closed 17 years ago
#6067 closed (worksforme)
Small addition to newForms documentation regarding required fields in templates
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | documentation | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the documentation:
http://www.djangoproject.com/documentation/newforms/#highlighting-required-fields-in-templates
It might be useful to give an example of how to check if a field is required when accessing a form field directly. This would be in addition to the existing example which is demonstrating use when iterating over a form.
I'd suggest an example such as {% if form.fieldName.field.required %}*{% endif %}
Thanks
Note:
See TracTickets
for help on using tickets.
The documentation: http://www.djangoproject.com/documentation/newforms/#complex-template-output already contains
an example, that you can use {{ form.fieldname }}.
Nevertheless thank you for trying to improve the documentation.