AttributeError у объекта 'WSGIRequest' нет атрибута 'Post'
Когда я нажимаю кнопку голосовать, я получаю эту ошибку AttributeError at /polls/2/vote/ У объекта 'WSGIRequest' нет атрибута 'Post'. Когда я пытался проголосовать за любой опрос. Вот мой файл results.html Я использую django==3.2 и python 3.8
Вот мои результаты.html
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
<fieldset>
<legend><h1>{{ question.question_text }}</h1></legend>
{% if error_message %}
<p><strong>{{ error_message }}</strong></p>
{% endif %}
{% 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 %}
</fieldset>
<input type="submit" value="Vote" >
</form>
а это моя функция просмотра голосования в приложении polls Она всегда показывает исключение в строке номер 4 кода
def vote(request, question_id):
question = get_object_or_404(Question, pk=question_id)
try:
selected_choice = question.choice_set.get(pk=request.Post['choice'])
except(KeyError, Choice.DoesNotExist):
return render(request, 'polls/detail.html', {'question': question, 'error_message': "You didn't select a choice"})
else:
selected_choice.votes += 1
selected_choice.save()
return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))