Error while learn by Django Tutorial Chapter 4

26 views
Skip to first unread message

DamnGeniuses' Squad

unread,
Feb 19, 2020, 7:47:29 AM2/19/20
to Django users

NoReverseMatch at /polls/1/

Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['polls/(?P<question_id>[0-9]+)/vote/$']
Request Method:GET
Request URL:http://127.0.0.1:8000/polls/1/
Django Version:3.0.3
Exception Type:NoReverseMatch
Exception Value:
Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['polls/(?P<question_id>[0-9]+)/vote/$']
Exception Location:C:\Users\Andhika\AppData\Local\Programs\Python\Python38\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 677
Python Executable:C:\Users\Andhika\AppData\Local\Programs\Python\Python38\python.exe
Python Version:3.8.1
Python Path:
['E:\\TestingKetiga-2\\mysite',
 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\lib',
 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38',
 'C:\\Users\\Andhika\\AppData\\Roaming\\Python\\Python38\\site-packages',
 'C:\\Users\\Andhika\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages']
Server time:Wed, 19 Feb 2020 09:56:21 +0000

Error during template rendering

In template E:\TestingKetiga-2\mysite\polls\templates\polls\detail.html, error at line 5

Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['polls/(?P<question_id>[0-9]+)/vote/$']

1<h1>{{ question.question_text }}</h1>
2
3{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
4
5<form action="{% url 'polls:vote' question.id %}" method="post">
6{% csrf_token %}
7{% for choice in question.choice_set.all %}
8 <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
9 <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
10{% endfor %}
11<input type="submit" value="Vote">
12</form>

Please Help me to solve this so i can continue to learn django 
Thankyouu
Reply all
Reply to author
Forward
0 new messages