Commit 057f182c authored by chris's avatar chris

fix a nasty bug related to dates reordering

parent fe56165b
......@@ -153,7 +153,7 @@ def vote(request, poll_id):
if request.method == 'POST':
form = BulletinForm(request.POST,initial={'poll': poll.id,})
vforms = [ [VoteForm(request.POST, prefix=choice) ] for choice in Choice.objects.filter(poll=poll.id) ]
vforms = [ [VoteForm(request.POST, prefix=choice) ] for choice in Choice.objects.filter(poll=poll.id).order_by('choice') ]
if form.is_valid():
if request.user.is_authenticated():
......@@ -233,8 +233,7 @@ def vote(request, poll_id):
vforms = [ [ VoteForm(initial={'choice': choice,'voice': True,}, prefix=choice) ] for choice in Choice.objects.filter(poll=poll_id) ]
else:
# Default formset for unknown user
vforms = [ [ VoteForm(initial={'choice': choice,}, prefix=choice) ] for choice in Choice.objects.filter(poll=poll_id) ]
vforms = [ [ VoteForm(initial={'choice': choice,}, prefix=choice) ] for choice in Choice.objects.filter(poll=poll_id).order_by('choice') ]
if request.user.is_authenticated():
voter = str(request.user)
try:
......@@ -247,7 +246,7 @@ def vote(request, poll_id):
we should concatenate the existing votes with empty remaing ones...
Give an empty bulletin for now.
"""
vforms = [ [ VoteForm(initial={'choice': vote.choice,'voice': vote.voice, 'comment': vote.comment,}, prefix=vote.choice) ] for vote in Vote.objects.filter(bulletin=bulletin) ]
vforms = [ [ VoteForm(initial={'choice': vote.choice,'voice': vote.voice, 'comment': vote.comment,}, prefix=vote.choice) ] for vote in Vote.objects.filter(bulletin=bulletin).order_by('choice__choice') ]
except:
pass
......@@ -269,7 +268,7 @@ def vote(request, poll_id):
we should concatenate the existing votes with empty remaing ones...
Give an empty bulletin for now.
"""
vforms = [ [ VoteForm(initial={'choice': vote.choice,'voice': vote.voice, 'comment': vote.comment,}, prefix=vote.choice) ] for vote in Vote.objects.filter(bulletin=bulletin) ]
vforms = [ [ VoteForm(initial={'choice': vote.choice,'voice': vote.voice, 'comment': vote.comment,}, prefix=vote.choice) ] for vote in Vote.objects.filter(bulletin=bulletin).order_by('choice__choice') ]
except:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment