Sunday, October 4, 2015

NoReverseMatch at /polls/1/

Hi Django group,

I'm following the tutorial and get stuck on part 3, Removing hardcoded URLs in templates

I read through the topics that discuss this, but can't find the issue in my case.

my detail.html template looks like

<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
   
<li><a href="{% url 'detail' question.id %}">{{ choice.choice_text }}</a></li>
{% endfor %}
</ul>


in my urls.py for the polls project I have

urlpatterns = [
     url
(r'^$', 'index', name="index"),
     url
(r'^(?P<question_id>\d+)/$', views.detail, name="detail"),
     url
(r'^(?P<question_id>\d+)/results/$', 'results', name="results"),
     url
(r'^(?P<poll_id>\d+)/vote/$', 'vote', name="vote"),
]

Thanks for any suggestion,
jack

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/298b2f49-8374-4e54-bfd3-639a7de3af7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment