[Django]-Django template: get data from dictionary

3👍

You are having a list of dicts not a dict, so looping like that wouldn’t work. You should do:

{% for item in number_of_books %}
    <li>{{ item.num_books }} - {{ item.name }}</li>
{% endfor %}

Leave a comment