Skip to content

Instantly share code, notes, and snippets.

@bq1990
Created August 18, 2017 19:41
Show Gist options
  • Save bq1990/07b9702319f04fafc9512b7000f1cabd to your computer and use it in GitHub Desktop.
Save bq1990/07b9702319f04fafc9512b7000f1cabd to your computer and use it in GitHub Desktop.
Django distinct count
dobs = User.objects.values('date_of_birth') \
.annotate(count=Count('date_of_birth', distinct=True)).all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment