default provider_service for volt tenant
diff --git a/xos/cord/models.py b/xos/cord/models.py
index 2ae2b72..7ec4137 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -18,9 +18,8 @@
from hpc.models import *
from cord.models import *
django.setup()
-svc = VOLTService.get_service_objects().all()[0]
-t = VOLTTenant(provider_service=svc)
+t = VOLTTenant()
t.caller = User.objects.all()[0]
t.save()
@@ -58,6 +57,12 @@
KIND = "vOLT"
+ def __init__(self, *args, **kwargs):
+ volt_services = VOLTService.get_service_objects().all()
+ if volt_services:
+ self._meta.get_field("provider_service").default = volt_services[0].id
+ super(VOLTTenant, self).__init__(*args, **kwargs)
+
@property
def vcpe(self):
if getattr(self, "cached_vcpe", None):