#14077 closed (duplicate)
Need an easy way to display model instance field names and values in templates
Reported by: | haroldb | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.2 |
Severity: | 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
Is it possible to write a helper that would take a bound ModelForm, and allow it to be displayed in a template something like:
<table> {% for field in fields %} <tr> <td>{{ field.name }}</td> <td>{{ field.value }}</td> </tr> {% endfor %} </table>
It would only display those fields that should be displayed to users (e.g. ignore 'editable=False', etc).
This would make displaying models to users much simpler, since if the definition of the model changed, it wouldn't be necessary to update the template. It'd be great if this was a standard helper.
Thanks
Change History (3)
comment:1 by , 14 years ago
milestone: | → 1.3 |
---|
comment:2 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #10427