diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2020-06-23 20:58:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2020-06-23 20:58:26 +0000 |
commit | 2b15204ca0f8d9a51c3b4963db904d797ebb8186 (patch) | |
tree | d0d85f1307fa7005eab8757da4366ccddfb441f9 /src/resource_inventory | |
parent | 6a41bf4f6f0b84e84293b7f2649ba60a9c78818f (diff) | |
parent | 03f767a2833293b7a0412eba9dce438a4b074b87 (diff) |
Merge "Quick Booking Menu Resource Availibility"
Diffstat (limited to 'src/resource_inventory')
-rw-r--r-- | src/resource_inventory/models.py | 5 |
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 |