Reputation: 2026
I've been struggling with this problem for a while and can't wrap my head around it. I've tried a lot of the answers on the handful of other questions with the same error but none of them work, and I can't see what I'm doing wrong.
In my template I have a table, each row has a link to view a information about a signature:
<td><a href="{% url 'signatures:detail' signature.identifier %}">View</a></td>
In my signatures.urls
file I have:
from django.conf.urls import patterns, url
from signatures import views
urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<signature_identifier>\w+)/$', views.DetailView.as_view(), name='detail'),
)
But when I try to browse to the index (192.168.1.4:8000/signatures/), I get the following error:
Reverse for 'detail' with arguments '(u'Rediff.Messenger',)' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'signatures/(?P<signature_identifier>\\w+)/$']
And highlights the line in my template file that I've included above.
The Primary Key for the database is the "identifier" column, which is text. This is Django version 1.7.5 on Python 2.7.5 running on CentOS 7.
I've included what I think to be relevant in the question, but the rest of the project is located on this GitHub repo.
Upvotes: 1
Views: 360
Reputation: 7049
Correct me if I'm wrong, but it looks like you're trying to feed the 'signature:details'
URL a string, but in your urls.py it looks like you only accept digits.
Try changing
url(r'^(?P<signature_identifier>\d+)/$', views.DetailView.as_view(), name='detail'),
to:
url(r'^(?P<signature_identifier>\w+)/$', views.DetailView.as_view(), name='detail'),
Upvotes: 2