1 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超5個(gè)贊
您必須將三個(gè)列表放在視圖中,然后將其發(fā)送到模板。然后同時(shí)在那里迭代它,如下所示...zip
def home(request):
...Your Logic...
context = { "all_teams": zip(first_team_names, second_team_names, hours_games)}
return render(request, 'profilecontent/home.html', context)
現(xiàn)在,解壓縮模板并同時(shí)對(duì)其進(jìn)行迭代...
{%extends 'profilecontent/base.html' %}
{%block content%}
<div class="container-home">
<div class="home-wrapper home-wrapper-first">
<p class='home-matches'>Przysz?e mecze <span class='home-week'>W3 D2</span></p>
<div class="match-wrapper">
<table>
{% for data in all_teams %}
<tr><td>{{ data.0.first_team }}</td><td>{{ data.2.hour_game }}</td><td>{{ data.1.second_team }}</td></tr>
{%endfor%}
</table>
</div>
</div>
<div class="home-wrapper home-wrapper-second">
</div>
</div>
{%endblock%}
添加回答
舉報(bào)