-1

index.html get problem

error information

my url: url(r'^(?P\d+)/$', views.detail)

wuzheng
  • 1
  • 2
  • 3
    Possible duplicate of [What is a NoReverseMatch error, and how do I fix it?](http://stackoverflow.com/questions/38390177/what-is-a-noreversematch-error-and-how-do-i-fix-it) – e4c5 Jul 16 '16 at 14:36
  • 1) You have a space at the end of the word: "detail " 2) you need to include in your url a new parameter: name="detail" – Abraham Jul 16 '16 at 14:38
  • Please [edit] your question to include the code and error message as embedded text, not as external images. Why are you using Django 1.3? That version hasn't been supported for several years, you should upgrade to 1.8.x (LTS) or 1.9.x. – knbk Jul 16 '16 at 22:15

1 Answers1

1

From docs

In order to perform URL reversing, you’ll need to use named URL patterns

For example:

url(r'^(?P\d+)/$', views.detail, name='detail')

And now you able to use reverse in python code:

reverse('detail', args=(some_number_here))

and url in templates:

{% url 'detail' some_number_here %}

And don't forget about namespaces if you use it.

Mark Mishyn
  • 3,921
  • 2
  • 28
  • 30