It is deliberate that Django's template language doesn't support
indirect attribute lookup. Helps to keep things simple (part of the
"keep programming out of templates" design goal). However, that's just
the goal of Django's core. You can easily write a template tag or a
filter to do this (I believe somebody already has something similar on
djangosnippets, but I don't have any link to it, since I never have a
need to do this).
An alternate approach is to write a template tag that takes the list of
field names as an argument (perhaps takes a variable containing the list
of field names) and then returns the list of values you want. So you
could write something like
{% get_fields c fields as my_values %}
{% for value in my_values %}
...
{% endfor %}
Here, I'm making up an API where the tag puts the result in the
my_values variable, so that you can subsequently loop over it. You could
store the values there, or a list of (name, value) pairs, or make it a
dictionary; whatever, you like.
Regards,
Malcolm