1👍
You pass a queryset of Audio
objects to the template:
# Create your views here.
def index(request):
context = {'songs': Audio.objects.all()}
return render(request, 'index.html', context)
in the template we can enumerate over the songs:
{% for audio in songs %}
{{ audio.book_title }} by {{ audio.artist }} </br>
{% endfor %}
Source:stackexchange.com