added results page
This commit is contained in:
parent
6e3368304a
commit
01d8c6ea13
9
polls/templates/polls/results.html
Normal file
9
polls/templates/polls/results.html
Normal 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>
|
||||
@ -20,8 +20,8 @@ def detail(request, question_id):
|
||||
|
||||
|
||||
def results(request, question_id):
|
||||
response = "You're looking at the results of question %s."
|
||||
return HttpResponse(response % question_id)
|
||||
question = get_object_or_404(Question, pk=question_id)
|
||||
return render(request, "polls/results.html", {"question": question})
|
||||
|
||||
|
||||
def vote(request, question_id):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user