Reputation: 5634
I don't really know how to describe what I'm aiming at (EDIT: I want a dynamic attribute lookup), but I'm trying to do something like this
<p>{{dict.{{object.field}}}}</p>
in a template. I also tried:
{% with object.field as field %}
{{dict.field}}
{% endwith %}
which didn't work either. Do you know how to tackle this properly?
Upvotes: 0
Views: 127
Reputation: 663
To loop through a dictionary you use "for":
{% for dictionary.object as obj %}
{{ obj.field }}
{% endfor %}
Upvotes: 0