Created
June 23, 2017 17:26
-
-
Save alexphelps/fbef6debc5125f73ed9cf629918f0b78 to your computer and use it in GitHub Desktop.
Accounts Table Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accounts = Account.objects.annotate(client_count=Count('client'), users_count=Count('users')) | |
account_data = [] | |
for account in accounts: | |
account_data.append( | |
{ | |
'id': account.id, | |
'name': account.name, | |
'clients': account.client_count, | |
'users': account.users_count | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment