[Answered ]-NoReverseMatch named urls Django

2👍

You need to pass in arguments (I use keyword args here, but positional is okay too) for the url’s parameters.

In a list view, you’re probably iterating over your items, so something like this works:

{% for thing in thing_list %}
    ...
    <div id='vote'><a href='{% url "thing_rating" object_id=thing.id score=5 %}'>Up</a></div>
    ...
{% endfor %}

I think you also need quotes around the url name.

Here’s more on the url tag: https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url

Leave a comment