Skip to content

Instantly share code, notes, and snippets.

@Visgean
Created April 24, 2015 14:39
Show Gist options
  • Select an option

  • Save Visgean/9eb4b595eeb1ac808a7e to your computer and use it in GitHub Desktop.

Select an option

Save Visgean/9eb4b595eeb1ac808a7e to your computer and use it in GitHub Desktop.
>>> voting_round_instance = models.VotingRound.objects.first()
>>> voting_round_instance.vote_set.values('vote').annotate(count=Count('vote')).distinct()
[{'vote': u'decline', 'count': 1}, {'vote': u'neutral', 'count': 1}, {'vote': u'decline', 'count': 1}, {'vote': u'approve', 'count': 1}, {'vote': u'approve', 'count': 1}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment