aboutsummaryrefslogtreecommitdiffstats
path: root/src/dashboard
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-02-13 14:25:24 -0500
committerParker Berberian <pberberian@iol.unh.edu>2020-02-13 14:25:24 -0500
commit8c012f8a9bc64add11920688abcd6981278cb0ea (patch)
tree99772d9361784d2724d1665c566c69888ff7d5e9 /src/dashboard
parentf5cdab1569b26df0c7ffc3df1529f095116fd13a (diff)
Fix Imports
Fixes stale import statements. The dashboard can now come up and we can run our unit tests Change-Id: I7189afb2cd37aaa2492de065c236b6aa9a35de5b Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/dashboard')
-rw-r--r--src/dashboard/utils.py18
-rw-r--r--src/dashboard/views.py4
2 files changed, 20 insertions, 2 deletions
diff --git a/src/dashboard/utils.py b/src/dashboard/utils.py
index af2461e..3d63366 100644
--- a/src/dashboard/utils.py
+++ b/src/dashboard/utils.py
@@ -1,3 +1,14 @@
+##############################################################################
+# Copyright (c) 2020 Parker Berberian and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from django.core.exceptions import ObjectDoesNotExist
+
class AbstractModelQuery():
"""
@@ -22,3 +33,10 @@ class AbstractModelQuery():
result = []
for model in cls.model_list:
result += list(model.objects.filter(*args, **kwargs))
+
+ @classmethod
+ def get(cls, *args, **kwargs):
+ try:
+ return cls.filter(*args, **kwargs)[0]
+ except IndexError:
+ raise ObjectDoesNotExist()
diff --git a/src/dashboard/views.py b/src/dashboard/views.py
index 2f37774..498bd9d 100644
--- a/src/dashboard/views.py
+++ b/src/dashboard/views.py
@@ -15,7 +15,7 @@ from django.shortcuts import render
from account.models import Lab
-from resource_inventory.models import Image, HostProfile
+from resource_inventory.models import Image, ResourceProfile
from workflow.workflow_manager import ManagerTracker
@@ -80,7 +80,7 @@ class LandingView(TemplateView):
hosts = []
- for host_profile in HostProfile.objects.all():
+ for host_profile in ResourceProfile.objects.all():
name = host_profile.name
description = host_profile.description
in_labs = host_profile.labs