Django _set.all Filter Not Working In Template
I'm trying to filter a list of objects in my database but I can't get it to work on the template using _set.all. The strange thing is it's something I've done in two other places i
Solution 1:
You have golftour.golftournament_set.all
nested in a loop on the context list golf_monthly_view
(not sure why you're doing this), which I think is empty because the ListView QuerySet is wrong:
queryset = GolfMonthlyView.objects.all()
# ^^^^ ?? This is not a model
If you yank off the outer for loop for example, the inner loops should proceed if the QuerySets are not empty:
{% for competition in golftour %}
{% for golftournament in golftour.tournament_set.all %}
<ul>
<li>{{golftournament.name}}</li>
</ul>
{% endfor %}
{% endfor %}
Post a Comment for "Django _set.all Filter Not Working In Template"