Here.

urls.py

from django.urls import path

from . import views


app_name = 'polls'
urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('<int:pk>/', views.DetailView.as_view(), name='detail'),
    path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),
    path('<int:question_id>/vote/', views.vote, name='vote'),
]


On Tue, Mar 14, 2023 at 3:44 PM Sandip Bhattacharya <
[email protected]> wrote:

> Can you share your urls.py?
>
>
> On Mar 14, 2023, at 1:33 AM, Nithin Kumar <[email protected]> wrote:
>
> Hi,
>
> Stuck with this problem
>
> https://docs.djangoproject.com/en/4.1/intro/tutorial04/
>
> NoReverseMatch at /polls/2/Reverse for 'vote' with arguments '(2,)' not
> found. 1 pattern(s) tried: ['polls/<int:question_id/vote/\\Z']
>
> My detail.html is like this and it is failing at Line 1.
> I checked all solutions online but no luck.
>
> <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>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d6c40407-64a0-4418-ba9a-39db89b1c1dcn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d6c40407-64a0-4418-ba9a-39db89b1c1dcn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/8mapBVGvyMA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/A42F210A-ED92-49F6-A647-D57C4C6814B0%40showmethesource.org
> <https://groups.google.com/d/msgid/django-users/A42F210A-ED92-49F6-A647-D57C4C6814B0%40showmethesource.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALZgFFcJfRUyB7C-vHFug7BoqD_zhrp9xOccABKBFnLuFTLF_Q%40mail.gmail.com.

Reply via email to