NoReverseMatch() error while learning Python <Django Documentation Chapter 4>

617 views
Skip to first unread message

DamnGeniuses' Squad

unread,
Feb 19, 2020, 7:48:17 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 fix this , i want to learn more about Django , but i already searching for 3 hours but got no solution yet
Thankyouu

Jorge Gimeno

unread,
Feb 19, 2020, 12:03:59 PM2/19/20
to django...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5374455-e259-4ac7-b16d-2b55c8dd6924%40googlegroups.com.

Would you be able to show us your polls/urls.py and your mysite/urls.py please?

-Jorge
Reply all
Reply to author
Forward
0 new messages