0

Here's yet another reverse error.

The URLs work as expected. I have the basic functionality mapped out and can click around the site without any problem. It's only when I try to reverse the URL that an error is thrown. If I comment out the call to the reverse everything works as expected, otherwise I get an error.

Reverse for 'app_view_list' with arguments '()' and keyword arguments '{'id': 'idvalue', 'title': 'titlevalue'}' not found.

NoReverseMatch

I'm developing on Django 1.4 with the dev server.

Here is the code

urls.py

urlpatterns = patterns('',
    url(r'^list/$', 'app.views.browse_list', name='app_browse_lists'),
    url(r'^list/(?P<id>[0-9]*)/(?P<title>[0-9a-zA-Z-]*)/$', 'app.views.list', name='app_view_list'),
)

The function I'm targeting

views.py

def list(request, id, title):
    print reverse ('app_view_list', kwargs={'id': 'idvalue', 'title': 'titlevalue'})
    ...
Community
  • 1
  • 1
OpCodeOmega
  • 319
  • 4
  • 14

1 Answers1

2

Are you actually passing idvalue? That won't match, as the id group is expecting a digit.

In any case, your regex would be better written:

r'^list/(?P<id>\d+)/(?P<title>[\d\s]+/$
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895