Chris Muench
Chris Muench

Reputation: 18328

Django 1.4 NoReverseMatch Found

urls.py

urlpatterns = patterns('',
    url(r'^$', 'entertainment_website.views.index'),
    url(r'^story/(?P<news_type>\d+)/(?P<story_id>\d+)', 'entertainment_website.views.story'),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

URL Creation:

<h2 class="main_story_headline"><a href="{% url entertainment_website.views.story story_id=story.id news_type=story.news_type %}">{{ story.title }}</a></h2>

What am I doing incorrectly to cause the following error:

NoReverseMatch at /
Reverse for 'entertainment_website.views.story' with arguments '()' and keyword arguments '{'story_id': 690, 'news_type': u'nightlife'}' not found.

Upvotes: 0

Views: 72

Answers (1)

news_type supposed to be an integer, but you passed string (unicode) so it fails.

Upvotes: 4

Related Questions