diff options
author | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2008-08-08 13:43:11 +0000 |
---|---|---|
committer | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2008-08-08 13:43:11 +0000 |
commit | b638469a22df4fb92da63a54295347024cb55eb4 (patch) | |
tree | 103a98f9e44ddbb6c85c44ce9236c19cd101a263 | |
parent | aaaa8e862ba5a32af75386408d35e0a176c92542 (diff) | |
download | Papillon-b638469a22df4fb92da63a54295347024cb55eb4.tar.bz2 Papillon-b638469a22df4fb92da63a54295347024cb55eb4.zip |
Few bug correction.
-rw-r--r-- | polls/views.py | 11 |
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 |