added results page

This commit is contained in:
Josh Flatt 2025-11-22 21:01:43 -06:00
parent 6e3368304a
commit 01d8c6ea13
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,9 @@
<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
<li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}</li>
{% endfor %}
</ul>
<a href="{% url 'polls:detail' question.id %}">Vote again?</a>

View File

@ -20,8 +20,8 @@ def detail(request, question_id):
def results(request, question_id): def results(request, question_id):
response = "You're looking at the results of question %s." question = get_object_or_404(Question, pk=question_id)
return HttpResponse(response % question_id) return render(request, "polls/results.html", {"question": question})
def vote(request, question_id): def vote(request, question_id):