Code

Ticket #1464: tutorial04.diff

File tutorial04.diff, 579 bytes (added by ubernostrum, 8 years ago)

Patch to fix a problem in tutorial 4

Line 
1Index: tutorial04.txt
2===================================================================
3--- tutorial04.txt      (revision 2653)
4+++ tutorial04.txt      (working copy)
5@@ -55,7 +55,7 @@
6     def vote(request, poll_id):
7         p = get_object_or_404(Poll, pk=poll_id)
8         try:
9-            selected_choice = p.choice_set.filter(pk=request.POST['choice'])
10+            selected_choice = p.choice_set.get(pk=request.POST['choice'])
11         except (KeyError, Choice.DoesNotExist):
12             # Redisplay the poll voting form.
13             return render_to_response('polls/detail', {