I have an url pattern with one optional parameter:
# urls.py :
url(r'^(page/(?P<page>\w+))?$', MyIndexView.as_view(), name='index'),
Pagination and everything else works well, until I create an url to a specific page in my template:
# templates/mysite.html
{% url 'index' 54 %}
Then I get an error:
Reverse for 'index' with arguments '(54,)' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'(page/(?P<page>\\w+))?$']
Without the parameter it works:
{% url 'index' %}
I also tried:
{% url 'index' page=54 %}
and got similar error.