From 03f767a2833293b7a0412eba9dce438a4b074b87 Mon Sep 17 00:00:00 2001 From: ssmith Date: Wed, 17 Jun 2020 11:44:30 -0400 Subject: Quick Booking Menu Resource Availibility Signed-off-by: Sean Smith Change-Id: I79f411af8996698d2c553185eed0221792a348d0 --- src/resource_inventory/models.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/resource_inventory') diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py index 557a4fc..4a6375d 100644 --- a/src/resource_inventory/models.py +++ b/src/resource_inventory/models.py @@ -14,6 +14,7 @@ from django.db import models from django.db.models import Q import re +from collections import Counter from account.models import Lab from dashboard.utils import AbstractModelQuery @@ -169,6 +170,10 @@ class ResourceTemplate(models.Model): configs = self.resourceConfigurations.all() return list(configs) + def get_required_resources(self): + profiles = Counter([str(config.profile) for config in self.getConfigs()]) + return dict(profiles) + def __str__(self): return self.name -- cgit 1.2.3-korg