CORD-879 eliminate proxy models in vtr service
Change-Id: Iab26025c87b18c26c83b5857138a17fc3b04b10d
diff --git a/xos/api/tenant/truckroll.py b/xos/api/tenant/truckroll.py
index cc8d62b..ac781bf 100644
--- a/xos/api/tenant/truckroll.py
+++ b/xos/api/tenant/truckroll.py
@@ -7,8 +7,10 @@
from core.models import *
from django.forms import widgets
from services.vtr.models import VTRTenant, VTRService
+from services.volt.models import CordSubscriberRoot
from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+from django.contrib.contenttypes.models import ContentType
def get_default_vtr_service():
vtr_services = VTRService.get_service_objects().all()
@@ -45,6 +47,11 @@
def isSynced(self, obj):
return (obj.enacted is not None) and (obj.enacted >= obj.updated)
+ def create(self, validated_data):
+ # force the target_type to be CordSubscriberRoot
+ validated_data["target_type_id"] = ContentType.objects.get_for_model(CordSubscriberRoot).id
+ return super(VTRTenantSerializer, self).create(validated_data)
+
class TruckRollViewSet(XOSViewSet):
base_name = "truckroll"
method_name = "truckroll"