[Answer]-Error during template rendering

0👍

In urls.py of application,

urlpatterns = {...}

should be

urlpatterns = [...]

1👍

Did you define the ‘polls’ namespace correctly in your root url’s like this?

urlpatterns = [
    url(r'^polls/', include('polls.urls', namespace="polls")),
    url(r'^admin/', include(admin.site.urls)),
]

change this line

return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))

to

return HttpResponseRedirect(reverse('polls:results', kwargs={'pk':p.id}))

0👍

Have you tried to use named arguments for your links, like :

{% url 'polls:vote' question_id=question.id %}

or in the view :

return HttpResponseRedirect(reverse('polls:results', kwargs={'pk': p.pk}))
👤BriceP

Leave a comment