django

Django Template Dictionary Items

How to access key/value pairs from a dictionary in the django template interface.

{% for method in comparator.methods %}
		
	{% for model,chain in method.structure_percentage_by_chain.items %}
		<p>Model: {{model}}</p>
				
		{% for k in chain.items %}
			<p>{{ k.0 }}</p>
			
			{% for v in k.1.items %}
			<p>{{v.0}} :: {{v.1}}</p>
			{% endfor %}
			
		{% endfor %}
		
	{% endfor %}
		
{% endfor %}

This gives me something like the following when I reload the page.

=====
Model: 1
A
other :: 56.0
sheet :: 44.0
helix :: 0.0
C
other :: 100.0
sheet :: 0.0
helix :: 0.0
=====

Naturally, better markup should be applied.