I am new to Python/Django development, i want to loop through a dic value that i am sending from my view on my template but i can't get the value base on index/key. Kindly help me out.
My View
def contact(request):
contactDetails = {
'name': ['Adeola Ajayi', 'Olayemi'],
'email': ['[email protected]', '[email protected]']
}
return render(request, 'PythonWeb/contact.html',
{'contactDetails':contactDetails})
My Template
{% block content %}
<br><br>
{% for contact in contactDetails%}
<p> name: {{ contact.name }} </p>
<p> name: {{ contact.email }} </p>
{% endfor %}
{% endblock %}
This is how i want my template to display
name: Adeola Ajayi
email: [email protected]
name: Olayemi
email: [email protected]