Opened 8 years ago

Closed 8 years ago

#16033 closed New feature (duplicate)

get_field_display: Django needs a filter to allow get_field_display for a dynamic field

Reported by: thepapermen Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


{{ SomeModel.get_field_display }} is nice, but it is handy only for a specified field.

If One wants to write a more universal template which should work with any set of fields, this won't work.

What I propose is a universal filter which should provide human-readable name for a field of any type.

For example, like this:


{% for item in query %}


{% for field in fields %}


{% endfor %}


{% endfor %}


This will be a simple yet powerful way to create nice human-readable tables from Django models and forms.

Change History (1)

comment:1 Changed 8 years ago by Aymeric Augustin

Resolution: duplicate
Status: newclosed

Duplicate of #16034 - double submission.

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