Skip to content

Instantly share code, notes, and snippets.

@akshar-raaj
Created August 10, 2019 17:45
Show Gist options
  • Save akshar-raaj/7ff3116c33e513cd51d624cc64df7a49 to your computer and use it in GitHub Desktop.
Save akshar-raaj/7ff3116c33e513cd51d624cc64df7a49 to your computer and use it in GitHub Desktop.
Question.objects.annotate(num_votes=Sum('choice__votes')).filter(num_votes__isnull=False).order_by('num_votes')[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment