Ben Kulka
Ben Kulka

Reputation: 13

Django URL with parameters not working

I'm trying to use pass a parameter to a URL in Django, but I keep getting this error:

 Page not found (404)
Request Method: GET
Request URL:    http://localhost:8000/%7B%25%20url%20review%20review_id%3D3%20%25%7D
Using the URLconf defined in soundclinic.urls, Django tried these URL patterns, in this order:

[name='index']
login/ [name='login']
register/ [name='register']
create_user [name='create_user']
<int:review_id>/review/ [name='review']
admin/
main/
The current path, {% url review review_id=3 %}, didn't match any of these.

The link I am follow has a tag like above: {% url review review_id=3 %}

I'm not sure what I'm not including right, as it looks like I'm writing out the url tag correctly and urls.py seems to be configured correcely as well.

Manually entering in the URL calls the correct views.py function, so it only has to do with my urls.py file.

Upvotes: 1

Views: 1818

Answers (1)

lbris
lbris

Reputation: 1249

As kszl already said, you must use " ' " around your URL name.

{% url 'review' review_id=3 %}

It supposes you have a URL in some url.py that has the name "review". It seems to be the case though since we can see

<int:review_id>/review/ [name='review']

in your log message.

Upvotes: 1

Related Questions