Opened 15 years ago
Closed 13 years ago
#15589 closed New feature (fixed)
form's field.value not documented
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Documentation | Version: | 1.3-beta |
| Severity: | Normal | Keywords: | Form Field Value |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
On http://docs.djangoproject.com/en/dev/topics/forms/
Section "Looping over the form's fields"
Add:
{{ field.value }}
The value of the field.
Example usage:
{% for field in form %}
{% if field.value %}
<p>{{ field.label_tag }}:{{ field.value }}</p>
{% endif %}
{% endfor %}
Change History (6)
comment:1 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 15 years ago
| Type: | → New feature |
|---|
comment:3 by , 15 years ago
| Severity: | → Normal |
|---|
comment:6 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Looks like this info has been added since this ticket was created.
Note:
See TracTickets
for help on using tickets.
There are in fact several attributes and methods missing from that section about
BoundField...value(),css_classes(), etc. There's also no formal definition ofBoundFieldin the docs.I'd like to see a reference on
BoundFieldadded toref/forms/fields, and then link to that from thetopics/formsdocs. That'd be better than trying to shoehorn a bunch more material into a topic guide which isn't really aboutBoundFieldanyway.Moreover, the change to the example suggested in the description completely changes the functionality of the example. You'd no longer be rendering a form, you'd be displaying the values. If you were going to illustrate the use of
{{ field.value }}in the template there are better ways to go about it.