Why does this return NoReverseMatch?
html:
{% url vote thing.id thing.slug %}
urls.py:
url(r'^vote/(?P<object_id>\d+)/(?P<slug>[w\-]+)/$', 'app.views.the_view', name='vote'),
views.py:
def the_view(request, object_id, slug):
thing_list = Thing.objects.all()
return render(request, 'vote.html', {'thing_list':thing_list})
you must use the following:
since you have explicitly named the matched groups in your pattern.
Note that starting from Django 1.5 you must do:
instead of:
See it in the django docs here https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url