I need to display all the videos within a certain playlist. I can display all the avaliable playlists by using this loop:
{% for p in playlists %}
{{ p.playlist.name }}
{% endfor %}
How can I display all the videos in each playlist too?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s hard to say since you don’t show your models, but something like this could work:
I’m assuming your videos have a
ForeignKey(Playlist, related_name="videos")field.