I have this view function:
def index(request,model,pk=None):
return list_detail.object_list(
request,
queryset=model.objects.all(),
paginate_by=10,
template_name='index.html',
extra_context=dict(
column_titles = [f.name for f in model._meta.fields],
)
)
Where index.html is:
<table>
<tr>
{% for title in column_titles %}
<th>{{title}}</th>
{% endfor %}
</tr>
{% for object in object_list %}
<tr>
{% for name in column_titles %}
<td>
{{*what goes here*}}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
What do I put in the marked spot to be the equivalent of
getattr(object,name)?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
no, that is the equivalent of:
getattr(object,'name')
I want:
getattr(object,name)
Subtle, but rather important, difference...
I agree that it doesn't belong in the template language, but it's
surprising that there's no standard filter to do this...
Is there an open issue for this or should I raise one?