0

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?

3
  • Did you include these urls in url.py? Commented Sep 21, 2013 at 13:38
  • Change tournament.id to 1, raises again? Commented Sep 21, 2013 at 13:46
  • Are you using a namespace in the root url? Commented Sep 21, 2013 at 13:51

1 Answer 1

4

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 %}
Sign up to request clarification or add additional context in comments.

1 Comment

well... it's working now, after rebooting the server. I wasn't explicit, but this seems like a better practise

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.