Something
public text v1 · immutabledef 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 })