My code which created the list is:
choices = []
for bet in Bet.objects.all():
#...
#Here is code that skip loop if bet.choice exist in choices[]
#...
temp = {
'choice':bet.choice,
'amount':bet.sum,
'count':bets.filter(choice=bet.choice).count()}
choices.append(temp)
choices.sort(key=attrgetter('choice'), reverse=True)
choices.sort(key=attrgetter('amount'), reverse=True)
choices.sort(key=attrgetter('count'), reverse=True)
I have to sort by list because model orderby() cant sort by count(),can it?