aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
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/resource_inventory
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/resource_inventory')
-rw-r--r--src/resource_inventory/admin.py47
-rw-r--r--src/resource_inventory/models.py1
-rw-r--r--src/resource_inventory/views.py6
3 files changed, 29 insertions, 25 deletions
diff --git a/src/resource_inventory/admin.py b/src/resource_inventory/admin.py
index ab21dd1..13afd99 100644
--- a/src/resource_inventory/admin.py
+++ b/src/resource_inventory/admin.py
@@ -16,11 +16,10 @@ from resource_inventory.models import (
DiskProfile,
CpuProfile,
RamProfile,
- GenericResourceBundle,
- GenericResource,
- GenericHost,
- GenericInterface,
- Host,
+ ResourceTemplate,
+ ResourceConfiguration,
+ InterfaceConfiguration,
+ Server,
Interface,
Network,
Vlan,
@@ -28,26 +27,30 @@ from resource_inventory.models import (
Scenario,
Installer,
Opsys,
- ConfigBundle,
OPNFVConfig,
OPNFVRole,
Image,
- ResourceConfiguration,
RemoteInfo
)
-profiles = [HostProfile, InterfaceProfile, DiskProfile, CpuProfile, RamProfile]
-
-admin.site.register(profiles)
-
-generics = [GenericResourceBundle, GenericResource, GenericHost, GenericInterface]
-
-admin.site.register(generics)
-
-physical = [Host, Interface, Network, Vlan, ResourceBundle]
-
-admin.site.register(physical)
-
-config = [Scenario, Installer, Opsys, ConfigBundle, OPNFVConfig, OPNFVRole, Image, HostConfiguration, RemoteInfo]
-
-admin.site.register(config)
+admin.site.register([
+ ResourceProfile,
+ InterfaceProfile,
+ DiskProfile,
+ CpuProfile,
+ RamProfile,
+ ResourceTemplate,
+ ResourceConfiguration,
+ InterfaceConfiguration,
+ Server,
+ Interface,
+ Network,
+ Vlan,
+ ResourceBundle,
+ Scenario,
+ Installer,
+ Opsys,
+ OPNFVConfig,
+ OPNFVRole,
+ Image,
+ RemoteInfo])
diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py
index 20e080b..eec009a 100644
--- a/src/resource_inventory/models.py
+++ b/src/resource_inventory/models.py
@@ -200,6 +200,7 @@ class ResourceConfiguration(models.Model):
image = models.ForeignKey("Image", on_delete=models.PROTECT)
template = models.ForeignKey(ResourceTemplate, related_name="resourceConfigurations", null=True, on_delete=models.CASCADE)
is_head_node = models.BooleanField(default=False)
+ # name?
def __str__(self):
return "config with " + str(self.template) + " and image " + str(self.image)
diff --git a/src/resource_inventory/views.py b/src/resource_inventory/views.py
index 8c3d899..52f8c75 100644
--- a/src/resource_inventory/views.py
+++ b/src/resource_inventory/views.py
@@ -12,7 +12,7 @@ from django.views.generic import TemplateView
from django.shortcuts import get_object_or_404
from django.shortcuts import render
-from resource_inventory.models import HostProfile, Host
+from resource_inventory.models import ResourceProfile, ResourceQuery
class HostView(TemplateView):
@@ -20,13 +20,13 @@ class HostView(TemplateView):
def get_context_data(self, **kwargs):
context = super(HostView, self).get_context_data(**kwargs)
- hosts = Host.objects.filter(working=True)
+ hosts = ResourceQuery.filter(working=True)
context.update({'hosts': hosts, 'title': "Hardware Resources"})
return context
def hostprofile_detail_view(request, hostprofile_id):
- hostprofile = get_object_or_404(HostProfile, id=hostprofile_id)
+ hostprofile = get_object_or_404(ResourceProfile, id=hostprofile_id)
return render(
request,