CORD-1244 cleanup use of get_tenant/get_service
Change-Id: I89474025859ad0d0faf148b5c25706035908c71f
diff --git a/xos/admin.py b/xos/admin.py
index 5ab2f1c..d485b9a 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -43,7 +43,7 @@
)
def get_queryset(self, request):
- return ONOSService.get_service_objects_by_user(request.user)
+ return ONOSService.select_by_user(request.user)
class ONOSAppForm(forms.ModelForm):
def __init__(self,*args,**kwargs):
@@ -55,7 +55,7 @@
self.fields['kind'].initial = ONOS_KIND
self.fields['creator'].initial = get_request().user
if ONOSService.objects.exists():
- self.fields["provider_service"].initial = ONOSService.get_service_objects().all()[0]
+ self.fields["provider_service"].initial = ONOSService.objects.all()[0]
def save(self, commit=True):
return super(ONOSAppForm, self).save(commit=commit)
@@ -77,7 +77,7 @@
suit_form_tabs = (('general','Details'), ('tenantattrs', 'Attributes'))
def get_queryset(self, request):
- return ONOSApp.get_tenant_objects_by_user(request.user)
+ return ONOSApp.select_by_user(request.user)
admin.site.register(ONOSService, ONOSServiceAdmin)
admin.site.register(ONOSApp, ONOSAppAdmin)
diff --git a/xos/api/service/onos.py b/xos/api/service/onos.py
index a143b3d..5861947 100644
--- a/xos/api/service/onos.py
+++ b/xos/api/service/onos.py
@@ -34,7 +34,7 @@
base_name = "onos"
method_name = "onos"
method_kind = "viewset"
- queryset = ONOSService.get_service_objects().all()
+ queryset = ONOSService.objects.all()
serializer_class = ONOSServiceSerializer
custom_serializers = {"set_attribute": ServiceAttributeSerializer}
diff --git a/xos/api/tenant/onos/app.py b/xos/api/tenant/onos/app.py
index d4d3ab0..a93fa0d 100644
--- a/xos/api/tenant/onos/app.py
+++ b/xos/api/tenant/onos/app.py
@@ -11,7 +11,7 @@
from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
def get_default_onos_service():
- onos_services = ONOSService.get_service_objects().all()
+ onos_services = ONOSService.objects.all()
if onos_services:
return onos_services[0].id
return None
@@ -52,7 +52,7 @@
return patterns
def get_queryset(self):
- queryset = ONOSApp.get_tenant_objects().all()
+ queryset = ONOSApp.objects.all()
# Since name isn't a real database field of the Tenant object, we have
# to go through some extra work...
diff --git a/xos/attic/onosapp_model.py b/xos/attic/onosapp_model.py
index 5366952..a294f2d 100644
--- a/xos/attic/onosapp_model.py
+++ b/xos/attic/onosapp_model.py
@@ -1,5 +1,5 @@
def __init__(self, *args, **kwargs):
- onos_services = ONOSService.get_service_objects().all()
+ onos_services = ONOSService.objects.all()
if onos_services:
self._meta.get_field("provider_service").default = onos_services[0].id
super(ONOSApp, self).__init__(*args, **kwargs)
diff --git a/xos/tosca/resources/onosapp.py b/xos/tosca/resources/onosapp.py
index 0c7490a..39b3a2b 100644
--- a/xos/tosca/resources/onosapp.py
+++ b/xos/tosca/resources/onosapp.py
@@ -23,7 +23,7 @@
return args
def get_existing_objs(self):
- objs = ONOSApp.get_tenant_objects().all()
+ objs = ONOSApp.objects.all()
objs = [x for x in objs if x.name == self.obj_name]
return objs