Sunday, October 4, 2015

Re: NoReverseMatch at /polls/1/

Can you paste the entire error?

Also, read through the error page, it should show you which line is causing the problem.

-James

On Oct 4, 2015 9:24 AM, "jahan" <jvanhan@gmail.com> wrote:
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.

--
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/CA%2Be%2BciXQAJ_AdP4-BjGTwMABHZuMwt0A-_8cCPokaM4KVr5HJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment