Skip to content

Instantly share code, notes, and snippets.

@ikks
Created September 24, 2012 14:05
Show Gist options
  • Save ikks/3776116 to your computer and use it in GitHub Desktop.
Save ikks/3776116 to your computer and use it in GitHub Desktop.
annotate with a relation
CartSale.objects.annotate(Count('products'),Sum('products__quantity'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment