Skip to content

Instantly share code, notes, and snippets.

@ejucovy
Created June 18, 2012 02:38
Show Gist options
  • Save ejucovy/2946529 to your computer and use it in GitHub Desktop.
Save ejucovy/2946529 to your computer and use it in GitHub Desktop.
date = dateutil.parser.parse("1/1/2012")
users = User.objects.filter(actions__created_at__gte=date)
users = users.annotate(num_actions=Count('actions'))
users = users.filter(num_actions__gte=5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment