File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ < h1 > {{ question.question_text }}</ h1 >
2
+
3
+ < ul >
4
+ {% for choice in question.choice_set.all %}
5
+ < li > {{ choice.choice_text }} - {{ choice.votes }}
6
+ vote{{ choice.votes|pluralize }}</ li >
7
+ {% endfor %}
8
+ </ ul >
9
+
10
+ < a href ="{% url 'polls:detail' question.id %} "> Vote again?</ a >
Original file line number Diff line number Diff line change @@ -31,4 +31,9 @@ def vote(request, question_id):
31
31
selected_choice .save ()
32
32
# POST 데이터를 정상적으로 처리하였으면,
33
33
# 항상 HttpResponseRedirect를 반환하여 리다이렉션 처리함
34
- return HttpResponseRedirect (reverse ('polls:results' , args = (p .id ,)))
34
+ return HttpResponseRedirect (reverse ('polls:results' , args = (p .id ,)))
35
+
36
+
37
+ def results (request , question_id ):
38
+ question = get_object_or_404 (Question , pk = question_id )
39
+ return render (request , 'polls:results.html' , {'question' : question })
You can’t perform that action at this time.
0 commit comments