1👍
This is not the way to think about things. You can’t ask for the number of things in a completely separate view. Instead, you need to calculate them in the view you are currently using.
You can use aggregation to count the number of items in each state:
Job.objects.values('state').annotate(count=Count('state'))
Source:stackexchange.com