Skip to content

Instantly share code, notes, and snippets.

@qpfiffer
Created June 25, 2013 18:46
Show Gist options
  • Save qpfiffer/5861165 to your computer and use it in GitHub Desktop.
Save qpfiffer/5861165 to your computer and use it in GitHub Desktop.
reduce(lambda accum, val: dict(accum.items() + {val[0]: accum.get(val[0], 0) + val[1]}.items()), [(route.code, drop.customer_set.count()) for route in Route.objects.all() for drop in route.drop_points.filter(active=True)], {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment