Reputation: 21
I went the tutorial for building the Django Polls website, but i got an error when I clicked the questions to see the details. The error message:
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^polls/ ^$ [name='index']
^polls/ ^(?P<pk>[0-9]+)/$ [name='detail']
^polls/ ^(?P<pk>[0-9]+)/results/$ [name='results']
^polls/ ^(?P<question_id>[0-9]+)/vote/$ [name='vote']
^admin/
The current URL, polls/“/polls/7/”, didn't match any of these.
I am not sure why it returns me the URL polls/“/polls/7/”. here is how i wrote the template:
{% if latest_question_list %}
<ol>
{% for q in latest_question_list %}
<li><a href=“{% url "polls:detail" q.id %}”>{{ q.question_text }}</a></li>
{% endfor %}
</ol>
{% else %}
<p> No Polls are available. </p>
{% endif %}
Follow-up on this question: I finally solved this issue by changing the smart link to the hard coded link.
Upvotes: 0
Views: 100
Reputation: 599778
You seem to be using curly ("smart") quotes in your code. They're not recognised by Django or your browser.
Swap them for normal quotes, and make sure you're using a text editor, not a word processor, to write your code.
Upvotes: 1