NoReverseMatch в / polls /
Реверс для 'голосования' с аргументами '(' ',)' не найден.Попробован 1 шаблон (ов): ['опросы / (? P [0-9] +) / голосование / $']
index.html:
{% if latest_question_list %}
<ul>
{% for question in latest_question_list %}
<!-- # the 'name' value as called by the url template tag -->
<li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li>
<!-- or:
<li><a href=" url 'detail' question.id "> question.question_text </a></li>
How does one make it so that Django knows which app view to create for a url when using the url template tag?
So we use polls:detail
-->
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
<h1>{{ question.question_text }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
{% endfor %}
<input type="submit" value="Vote">
</form>
enterописание изображения здесь введите описание изображения здесь
Ниже приведена ошибка консоли.Другие относительные вопросы в stackoverflow имеют ответ типа: не question_id!Это question.id!
ошибка в строке 123 Реверс для 'голосования' с аргументами '(' ',)' не найден.Попробован 1 шаблон (ов): ['опросы / (? P [0-9] +) / голосование / $']:
113 {% endfor %}
114 </ul>
115 {% else %}
116 <p>No polls are available.</p>
117 {% endif %}
118
119 <h1>{{ question.question_text }}</h1>
120
121 {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
122
123 <form action="{% url 'polls:vote' question.id %}" method="post">
124 {% csrf_token %}
125 {% for choice in question.choice_set.all %}
126 <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
127 <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
128 {% endfor %}
129 <input type="submit" value="Vote">
130 </form>
131 </content>