diff --git a/db.sqlite3 b/db.sqlite3 index 2170b7e..7e70edb 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/polls/templates/polls/results.html b/polls/templates/polls/results.html new file mode 100644 index 0000000..33b67b2 --- /dev/null +++ b/polls/templates/polls/results.html @@ -0,0 +1,9 @@ +

{{ question.question_text }}

+ + + +Vote again? \ No newline at end of file diff --git a/polls/views.py b/polls/views.py index c981dc1..d9742f1 100644 --- a/polls/views.py +++ b/polls/views.py @@ -20,9 +20,10 @@ def detail(request, question_id): return render(request, "polls/details.html", {"question": question}) + def results(request, question_id): - response = "you are looking at results for 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): question = get_object_or_404(Question, pk=question_id) @@ -37,4 +38,5 @@ def vote(request, question_id): selected_choice.votes += 1 selected_choice.save() - return HttpResponseRedirect(reverse("polls:results", args=(question.id,))) \ No newline at end of file + return HttpResponseRedirect(reverse("polls:results", args=(question.id,))) +