diff options
author | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2010-06-08 09:13:21 +0000 |
---|---|---|
committer | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2010-06-08 09:13:21 +0000 |
commit | 1963a111cb90d3bdb32749a18c3fd5c3d351c161 (patch) | |
tree | 76bc869ae12c2306bc8309e2001ebcbd79249029 | |
parent | b1c2eaab6b1628bd39482e281b34e04f8ecd19e4 (diff) | |
download | Papillon-1963a111cb90d3bdb32749a18c3fd5c3d351c161.tar.bz2 Papillon-1963a111cb90d3bdb32749a18c3fd5c3d351c161.zip |
Correct sort bug
-rw-r--r-- | papillon/polls/views.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/papillon/polls/views.py b/papillon/polls/views.py index e9ef572..300b313 100644 --- a/papillon/polls/views.py +++ b/papillon/polls/views.py @@ -455,8 +455,7 @@ def poll(request, poll_url): if choice.id not in choice_vote_ids: vote = Vote(voter=voter, choice=choice, value=None) vote.save() - idx = choices.index(choice) - voter.votes.insert(idx, vote) + voter.votes.sort(lambda x, y : cmp(choices.index(x.choice), choices.index(y.choice))) sums = [choice.getSum(poll.type == 'B') for choice in choices] vote_max = max(sums) c_idx = 0 |