fixed problem in assignment poll

This commit is contained in:
Oskar Hahn 2012-04-15 14:58:05 +02:00
parent 91c9e1e9ab
commit a3808c7b30

View File

@ -76,10 +76,11 @@ def view(request, assignment_id=None):
if request.user.has_perm('assignment.can_nominate_other'):
form = AssignmentRunForm()
polls = assignment.poll_set.all()
votes = []
for candidate in assignment.candidates:
tmplist = [[candidate, assignment.is_elected(candidate)], []]
for poll in assignment.poll_set.all():
tmplist = ((candidate, assignment.is_elected(candidate)), [])
for poll in polls:
if (poll.published and not request.user.has_perm('assignment.can_manage_assignment')) or request.user.has_perm('assignment.can_manage_assignment'):
# candidate exists in poll
if poll.get_options().filter(candidate=candidate).exists():
@ -92,8 +93,6 @@ def view(request, assignment_id=None):
tmplist[1].append("-")
votes.append(tmplist)
polls = assignment.poll_set.all()
return {
'assignment': assignment,
'form': form,
@ -422,7 +421,7 @@ class AssignmentPDF(PDFView):
def get_assignment_votes(self, assignment):
votes = []
for candidate in assignment.candidates:
tmplist = [[candidate, assignment.is_elected(candidate)], []]
tmplist = ((candidate, assignment.is_elected(candidate)), [])
for poll in assignment.poll_set.all():
if poll.published:
if poll.get_options().filter(candidate=candidate).exists():