def get_deployment_count(self):

        ret = self.stage_set.annotate(num_deployments=Count('deployment')).aggregate(total_deployments=Sum('num_deployments'))
        return ret['total_deployments']
Utility function to get the number of deployments a given project has
dataset/ETHPy150Open fabric-bolt/fabric-bolt/fabric_bolt/projects/models.py/Project.get_deployment_count