[Answered ]-Django ForeignKey attribute is not showing up in HTML

1👍

You can access the all the instances of Manga model associated with chapter instance by using _set as suffix in the following way:

{% for i in LastUpdated %}
    <p>{{i.chapter_number}}</p>
    <h2> manga model attributes below</h2>
    {% for j in i.manga_set.all %}
        {{j.manga_name}}
        {{j.manga_views}}
    {% endfor %}    
{% endfor %}

Also you should use Chapter.objects.all().order_by("relase_date") this queryset as using .values() gives you a key-value pair (dict).

Leave a comment