这是我的问题,
我认为,
object = Data.objects.all()
在模板中,
{% for obj in object %}
Here I can print Data...
But also I want to print Game and Extras. Where Game to related to "Data" through foreign
key & "Extras" is related to "Game" through foreign key. This is how I'm doing it,
{% for abc in obj.game_set.all %}
Here I can print ]Games related to Data.
but also I want to print Extras. this is what I'm doing,
{% for var in abc.extras_set.all %}
{{ var }}
{% endfor %}
{% endfor %}
{% endfor %}
一切都很好被接受这样一个事实,即我想要打印出最新的2款额外游戏。
我可以使用distortreversed&然后切片获得最新的2场比赛,但这将打印出最新的2场比赛,不会给最新的2场比赛带来额外的比赛。那么,我该怎么做?
有没有办法在视图和&amp ;;然后在模板中跟随for循环?