2👍
✅
In Django templates, you cannot use the data['today']
syntax to access the value of a dictionnary, you need to use the .
(data.today
):
{% for key, value in data.today.items %}
{{ key }} {{ value }}
{% endfor %}
👤Holt
0👍
try this:
If you want only dictionary field with only ‘today’ key then simply send data[‘today’] from view {‘data’: data[‘today’]} and then render it like:
{% for key, value in data.items %}
{{ key }} {{ value }}
{% endfor %}
If you want whole dictionary to be sent then,
{% for key, value in data.items %}
{% for k,v in value.items %}
{{k}} {{v}}
{% endfor %}
{% endfor %}
- [Answered ]-How to make a string visible on a webpage using Django form fields
- [Answered ]-Django test with a model called TestCase
- [Answered ]-Incorporating react redux into django
- [Answered ]-Django Apache: Target WSGI Script Cannot Be Loaded as Python Module
- [Answered ]-Ember Simple Auth Logout Action with Django Backend
Source:stackexchange.com