나는 Django tutorial (part 4)에 있으며 사용자가 설문 조사에 대한 답변을 선택할 수있는 양식을 만들려고합니다.장고 자습서에서 양식 제출이 실패하는 경우
{{ poll.question }}
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="/polls/vote/{{ poll.id }} " method="post">
{% csrf_token %}
{% for choice in poll.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>
다음은
Page not found (404)
Request Method: POST
Request URL: http://localhost:8000/polls/vote/6
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^polls/ ^$ [name='index']
^polls/ ^(?P<poll_id>\d+)/$ [name='detail']
^polls/ ^(?P<poll_id>\d+)/results/$ [name='results']
^polls/ ^(?P<poll_id>\d+)/vote/$ [name='vote']
^admin/
The current URL, polls/vote/6, didn't match any of these.
양식을 가지고 detail.html의 코드입니다 : 질문 그러나 나는 다음과 같은 오류가 보여주는 유지 '투표'(즉 옵션을 선택하고 양식을 제출)을 클릭하면, 제대로로드
문제가 라인 <form action="/polls/vote/{{ poll.id }} " method="post">
에있는 것으로 의심되지만 해결 방법을 모르겠습니다.
오른쪽 위 ... URL과 일치하는 패턴이 잘못되었습니다. –
예 ...이 모든 시간이 발생합니다 :) –