[Fixed]-Django – displaying values from a dictionary nested in a list in an html template

1👍

I think you should use this as :

{% for value in sites %}
    <li>{{value.site}}</li>
{% endfor %}   

It will now print the values in list

0👍

You can access a key in a dictionary using the dot notation:

Dictionary lookup, attribute lookup and list-index lookups are implemented with a dot notation:

   {{ my_dict.key }}
   {{ my_object.attribute }}
   {{ my_list.0 }}

For your code, that would be:

{% for value in sites %}
    <li>{{value.site}}</li>
{% endfor %}   
👤2ps

Leave a comment