This kind of data i have sent to my template x = [{'id': 668, 'title': 'ME2: Pressurisation Unit Maintenance Record', 'valuess': ['person', 'address', 'asset']}
return render(request, 'xyz.html', {'data': x})
want to run a for loop for a key named 'values' in my data set x
"x" is a key but it contains list of values as well. So want to run a for loop on a key "values" How to do this. anyone please help....I just started my programming career...i am stucked plz help me
CodePudding user response:
Either this:
{% for d in data %}
{% for value in d.values %}
<p>{{ value }}</p>
{% endfor %}
{% endfor %}
Or:
{% for d in data %}
{{ d.values }}
{% endfor %}