In your opinion, you only created one variable ( profile_dict ) to hold the dicts profile.
At each iteration of your for f in profile loop, you re-create this variable and overwrite its value with a new dictionary. Therefore, when you include profile_dict in the context passed to the template, it holds the last value assigned to profile_dict .
If you want to pass four profile_dicts templates to a template, you can do this in your view:
info_dict = [{u'Question 1': ['13365', '13344']}, {u'Question 2': ['13365']}, {u'Question 3': []}]
And then in your template:
{% for profile_dict in profile_dicts %} <ul> {% for k, v in profile_dict.items %} <li>{{ k }} : {{ v }}</li> {% endfor %} </ul> {% endfor %}
Paul D. Waite
source share