All pastes #69013 Raw Edit

Something

public text v1 · immutable
#69013 ·published 2006-06-22 11:57 UTC
rendered paste body
def results(request, election_id):

    election = get_object_or_404(Election, pk = election_id)

    present = { }

    votes = Vote.objects.all()

    for vote in votes:
	candidate_votes = CandidateVote.objects.filter(voter__hashkey__exact = vote)
	present[vote] = [ ]
	for candidate_vote in candidate_votes:
	    present[vote].append(candidate_vote)

    return render_to_response('results.html', { 'votes': present, 'election': election })