aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
diff options
context:
space:
mode:
authorssmith <ssmith@iol.unh.edu>2020-06-17 11:44:30 -0400
committerssmith <ssmith@iol.unh.edu>2020-06-23 12:26:07 -0400
commit03f767a2833293b7a0412eba9dce438a4b074b87 (patch)
treea34ebe7451ed7a81ae4a60943071125556a025f5 /src/resource_inventory
parentf96012fae9a106228ad80671a8c66476834a50db (diff)
Quick Booking Menu Resource Availibility
Signed-off-by: Sean Smith <ssmith@iol.unh.edu> Change-Id: I79f411af8996698d2c553185eed0221792a348d0
Diffstat (limited to 'src/resource_inventory')
-rw-r--r--src/resource_inventory/models.py5
1 files changed, 5 insertions, 0 deletions
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