summaryrefslogtreecommitdiff
path: root/polls
diff options
context:
space:
mode:
authoretienne2008-08-08 13:43:11 +0000
committeretienne2008-08-08 13:43:11 +0000
commitb638469a22df4fb92da63a54295347024cb55eb4 (patch)
tree103a98f9e44ddbb6c85c44ce9236c19cd101a263 /polls
parentaaaa8e862ba5a32af75386408d35e0a176c92542 (diff)
Few bug correction.
Diffstat (limited to 'polls')
-rw-r--r--polls/views.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/polls/views.py b/polls/views.py
index d3687f2..219590c 100644
--- a/polls/views.py
+++ b/polls/views.py
@@ -178,14 +178,13 @@ def poll(request, poll_url):
# probably been deleted
vote.delete()
else:
- vote.vote = 1
+ vote.value = 1
vote.save()
selected_choices.append(vote.choice)
except (ValueError, IndexError):
- # the vote don't exist with this choice
- v = Vote(voter=author, choice=choice, value=1)
- v.save()
- if key.startswith('choice_') and request.POST[key]:
+ # the vote don't exist anymore
+ pass
+ elif key.startswith('choice_') and request.POST[key]:
try:
id = int(key.split('_')[1])
choice = Choice.objects.filter(id=id)[0]
@@ -202,7 +201,7 @@ def poll(request, poll_url):
if choice not in selected_choices:
try:
v = Vote.objects.filter(voter=author, choice=choice)[0]
- v.vote = 0
+ v.value = 0
except IndexError:
# the vote don't exist with this choice : probably
# a new choice