Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#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: UI/UX:


Is it possible to write a helper that would take a bound ModelForm, and allow it to be displayed in a template something like:

    {% for field in fields %}
            <td>{{ }}</td>
            <td>{{ field.value }}</td>
    {% endfor %}

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.


Change History (3)

comment:1 Changed 8 years ago by haroldb

milestone: 1.3

comment:2 Changed 8 years ago by Anssi Kääriäinen

Resolution: duplicate
Status: newclosed

Duplicate of #10427

comment:3 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top