Error:
Reverse for 'polls.detail' with arguments '(4,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []Index.html (template)
{% if latest_poll_list %}
<ul>
{% for poll in latest_poll_list %}
<li><a href="{% url 'polls.detail' poll.id %}">{{ poll.question }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}views.py (polls)from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from polls.models import Poll
# Create your views here.
def index(request):
latest_poll_list = Poll.objects.order_by('-pub_date')[:5]
context = {'latest_poll_list':latest_poll_list}
return render(request, 'polls/index.html',context)
def detail(request,poll_id):
poll = get_object_or_404(Poll,pk=poll_id)
return render(request, 'polls/detail.html',{'poll':poll})
def results(request,poll_id):
return HttpResponse("You're looking at results of poll %s." % poll_id)
def vote(request,poll_id):
return HttpResponse("You're voting on poll %s." % poll_id)
Please post the url for your detail view.
--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8b3cd25c-ef81-4c1d-afba-8d70cd3fdb2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.