[Django]-Django TypeError objects is not iterable

5👍

The author_detail is a single Author object, so it does not make sense to iterate over it. What would be the elements over which you can iterate?

You can thus render it like:

{% extends 'base.html' %}

{% block content %}
<h1>Author Detail</h1>
<ul>
    <li>Name: {{ author_detail.first_name }} {{ author_detail.last_name }}</li>
    <li>Date of Birth: {{ author_detail.date_of_birth }}</li>
</ul>
{% endblock %}

Leave a comment