33👍
✅
Loop through the dictionary’s items to get the keys and values:
{% for key, value in test.items %}
-1👍
Not familiar with Django. However, by default, Python iterates over the keys for a dictionary. I am also going to assume you are using Python2. To get the values, you need to do:
{% for value in test.itervalues() %}
If you want both, you need to do:
{% for key, value in test.iteritems() %}
That will give you both the key and the value.
- South ignores change in field default value in Python / Django
- How can I use `email` in "django-rest-framework-simplejwt" instead of `username` to generate token?
Source:stackexchange.com