I have the following url conf:
url(r'^tournaments/(?P<tournament_id>\d+)/imports/$',
'club.apps.main.views.imports_view',
name='imports_tournament'),
And the following template tag:
{% url 'imports_tournament' tournament.id%}
However, this always raises no reverse url match found error.
Django version is 1.5, so the single quoted syntax should work..
What am I doing wrong?
When you pass an argument to the url
tag, it assumes you are passing in a positional argument. Your url view takes a keyword argument , so you need to be explicit:
{% url 'imports_tournament' tournament_id=tournament.id %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.