NoReverseMatch - учебник по Django 1.7 для начинающих

Я следую учебнику для начинающих в Django 1.7.1 и получаю эту ошибку

Reverse for 'vote' with arguments '(5,)' and keyword arguments '{}' not found. 0 pattern(s) tried: [] `poll\templates\poll\detail.html, error at line 12`

после небольшого исследования я обнаружил, что люди задают аналогичный вопрос, и кто-то предложил, чтобы они сняли деньги$ из общего URL, потому что urlloader просто берет пустую строку, в то время как это не дает мне ошибку No Reverse Match, он портит все остальное, всякий раз, когда я пытаюсь достичь любого другого URL, он перенаправляет меня на основной URL, в то время как без снятия наличных$ Я могу прекрасно перейти к этим URL. Так что же я делаю не так?

Вот URL проекта:

urlpatterns = patterns('',
    url(r'^poll/', include('poll.urls', namespace="poll")),
    url(r'^admin/', include(admin.site.urls)),
)

И приложение URL:

from django.conf.urls import patterns, url

from poll import views

urlpatterns = patterns('',
    #e.g. /poll/
    url(r'^

И мнения:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from poll.models import Question, Choice


class IndexView(generic.ListView):
    template_name = 'poll/index.html'
    context_object_name = 'latest_question_list'

    def get_queryset(self):
        """Return the last five published questions."""
        return Question.objects.order_by('-pup_date')[:5]


class DetailView(generic.DetailView):
    model = Question
    template_name = 'poll/detail.html'


class ResultsView(generic.DetailView):
    model = Question
    template_name = 'poll/results.html'


def votes(request, question_id):
    p = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form.
        return render(request, 'poll/detail.html', {
            'question': p,
            'error_message': "You didn't select a choice.",
        })
    else:
        selected_choice.votes += 1
        selected_choice.save()
        # Always return an HttpResponseRedirect after successfully dealing
        # with POST data. This prevents data from being posted twice if a
        # user hits the Back button.
        return HttpResponseRedirect(reverse('poll:results', args=(p.id,)))

Также я думаю, что это может быть связано с тем, как действие{%URL%} и методpost передаются, поэтому вот строка кода из файла шаблона, указанного в ошибке<form action="{% url 'poll:vote' question.id %}" method="post">

Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще, и спасибо заранее

, views.IndexView.as_view(), name='index'), #e.g. /poll/5/ url(r'^(?P<pk>\d+)/

И мнения:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from poll.models import Question, Choice


class IndexView(generic.ListView):
    template_name = 'poll/index.html'
    context_object_name = 'latest_question_list'

    def get_queryset(self):
        """Return the last five published questions."""
        return Question.objects.order_by('-pup_date')[:5]


class DetailView(generic.DetailView):
    model = Question
    template_name = 'poll/detail.html'


class ResultsView(generic.DetailView):
    model = Question
    template_name = 'poll/results.html'


def votes(request, question_id):
    p = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form.
        return render(request, 'poll/detail.html', {
            'question': p,
            'error_message': "You didn't select a choice.",
        })
    else:
        selected_choice.votes += 1
        selected_choice.save()
        # Always return an HttpResponseRedirect after successfully dealing
        # with POST data. This prevents data from being posted twice if a
        # user hits the Back button.
        return HttpResponseRedirect(reverse('poll:results', args=(p.id,)))

Также я думаю, что это может быть связано с тем, как действие{%URL%} и методpost передаются, поэтому вот строка кода из файла шаблона, указанного в ошибке<form action="{% url 'poll:vote' question.id %}" method="post">

Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще, и спасибо заранее

, views.DetailView.as_view(), name='detail'), #e.g. /poll/5/results/ url(r'^(?P<pk>\d+)/results/

И мнения:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from poll.models import Question, Choice


class IndexView(generic.ListView):
    template_name = 'poll/index.html'
    context_object_name = 'latest_question_list'

    def get_queryset(self):
        """Return the last five published questions."""
        return Question.objects.order_by('-pup_date')[:5]


class DetailView(generic.DetailView):
    model = Question
    template_name = 'poll/detail.html'


class ResultsView(generic.DetailView):
    model = Question
    template_name = 'poll/results.html'


def votes(request, question_id):
    p = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form.
        return render(request, 'poll/detail.html', {
            'question': p,
            'error_message': "You didn't select a choice.",
        })
    else:
        selected_choice.votes += 1
        selected_choice.save()
        # Always return an HttpResponseRedirect after successfully dealing
        # with POST data. This prevents data from being posted twice if a
        # user hits the Back button.
        return HttpResponseRedirect(reverse('poll:results', args=(p.id,)))

Также я думаю, что это может быть связано с тем, как действие{%URL%} и методpost передаются, поэтому вот строка кода из файла шаблона, указанного в ошибке<form action="{% url 'poll:vote' question.id %}" method="post">

Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще, и спасибо заранее

, views.ResultsView.as_view(), name='results'), #e.g. /poll/5/votes/ url(r'^(?P<question_id>\d+)/votes/

И мнения:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from poll.models import Question, Choice


class IndexView(generic.ListView):
    template_name = 'poll/index.html'
    context_object_name = 'latest_question_list'

    def get_queryset(self):
        """Return the last five published questions."""
        return Question.objects.order_by('-pup_date')[:5]


class DetailView(generic.DetailView):
    model = Question
    template_name = 'poll/detail.html'


class ResultsView(generic.DetailView):
    model = Question
    template_name = 'poll/results.html'


def votes(request, question_id):
    p = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form.
        return render(request, 'poll/detail.html', {
            'question': p,
            'error_message': "You didn't select a choice.",
        })
    else:
        selected_choice.votes += 1
        selected_choice.save()
        # Always return an HttpResponseRedirect after successfully dealing
        # with POST data. This prevents data from being posted twice if a
        # user hits the Back button.
        return HttpResponseRedirect(reverse('poll:results', args=(p.id,)))

Также я думаю, что это может быть связано с тем, как действие{%URL%} и методpost передаются, поэтому вот строка кода из файла шаблона, указанного в ошибке<form action="{% url 'poll:vote' question.id %}" method="post">

Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще, и спасибо заранее

, views.votes, name='votes'), )

И мнения:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.views import generic
from poll.models import Question, Choice


class IndexView(generic.ListView):
    template_name = 'poll/index.html'
    context_object_name = 'latest_question_list'

    def get_queryset(self):
        """Return the last five published questions."""
        return Question.objects.order_by('-pup_date')[:5]


class DetailView(generic.DetailView):
    model = Question
    template_name = 'poll/detail.html'


class ResultsView(generic.DetailView):
    model = Question
    template_name = 'poll/results.html'


def votes(request, question_id):
    p = get_object_or_404(Question, pk=question_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        # Redisplay the question voting form.
        return render(request, 'poll/detail.html', {
            'question': p,
            'error_message': "You didn't select a choice.",
        })
    else:
        selected_choice.votes += 1
        selected_choice.save()
        # Always return an HttpResponseRedirect after successfully dealing
        # with POST data. This prevents data from being posted twice if a
        # user hits the Back button.
        return HttpResponseRedirect(reverse('poll:results', args=(p.id,)))

Также я думаю, что это может быть связано с тем, как действие{%URL%} и методpost передаются, поэтому вот строка кода из файла шаблона, указанного в ошибке<form action="{% url 'poll:vote' question.id %}" method="post">

Пожалуйста, дайте мне знать, если вам нужно что-нибудь еще, и спасибо заранее

Ответы на вопрос(1)

Ваш ответ на вопрос