【发布时间】:2013-12-07 09:54:29
【问题描述】:
我有网址:
url(r'^tournament/(?P<tournament_id>\d+)/tour/$', chess.views.first_tour, name = 'first_tour'),
url(r'^tournament/(?P<tournament_id>\d+)/tour/match/(?P<pk>\d+)/$', chess.views.edit_match, name = 'edit_match'),
观看次数:
def first_tour(request, tournament_id):
...
matches = []
for item in items:
match = Match.objects.get(...)
matches.append(match)
return render(request, 'first_tour.html', {'matches':matches})
def edit_match(request, tournament_id, match_id ):
pass
一个模板,其中我有一个匹配循环和每个循环:
<a href="{% url 'edit_match' match.pk %}">Enter results</a>
为什么会出现错误:“edit_match”的反向参数“(5L,)”和关键字参数“{}”未找到。出现了吗?
【问题讨论】:
-
模板的 for 循环中 {{ match.pk }} 的输出是什么?
标签: python django django-templates django-views django-urls