CORD-1244 cleanup use of get_tenant/get_service
Change-Id: I014dce9df70cf023a2c82b96a43467c3250ac6b8
diff --git a/xos/admin.py b/xos/admin.py
index e0beabc..a479d9c 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -46,21 +46,21 @@
) #('hpctools.html', 'top', 'tools') )
def get_queryset(self, request):
- return VTRService.get_service_objects_by_user(request.user)
+ return VTRService.select_by_user(request.user)
class VTRTenantForm(forms.ModelForm):
target = forms.ModelChoiceField(queryset=CordSubscriberRoot.objects.all())
def __init__(self,*args,**kwargs):
super (VTRTenantForm,self ).__init__(*args,**kwargs)
- self.fields['provider_service'].queryset = VTRService.get_service_objects().all()
+ self.fields['provider_service'].queryset = VTRService.objects.all()
if self.instance:
if self.instance.target_id:
self.fields["target"].initial = CordSubscriberRoot.get_content_object(self.instance.target_type, self.instance.target_id)
if (not self.instance) or (not self.instance.pk):
self.fields['kind'].initial = VTR_KIND
- if VTRService.get_service_objects().exists():
- self.fields["provider_service"].initial = VTRService.get_service_objects().all()[0]
+ if VTRService.objects.exists():
+ self.fields["provider_service"].initial = VTRService.objects.all()[0]
def save(self, commit=True):
if self.cleaned_data.get("target"):
@@ -87,7 +87,7 @@
return (obj.enacted is not None) and (obj.enacted >= obj.updated)
def get_queryset(self, request):
- return VTRTenant.get_tenant_objects_by_user(request.user)
+ return VTRTenant.select_by_user(request.user)
admin.site.register(VTRService, VTRServiceAdmin)
admin.site.register(VTRTenant, VTRTenantAdmin)
diff --git a/xos/api/tenant/truckroll.py b/xos/api/tenant/truckroll.py
index 68db1ca..caf9e24 100644
--- a/xos/api/tenant/truckroll.py
+++ b/xos/api/tenant/truckroll.py
@@ -13,7 +13,7 @@
from django.contrib.contenttypes.models import ContentType
def get_default_vtr_service():
- vtr_services = VTRService.get_service_objects().all()
+ vtr_services = VTRService.objects.all()
if vtr_services:
return vtr_services[0]
return None
@@ -29,7 +29,7 @@
test = serializers.CharField()
scope = serializers.CharField()
argument = serializers.CharField(required=False)
- provider_service = serializers.PrimaryKeyRelatedField(queryset=VTRService.get_service_objects().all(), default=get_default_vtr_service)
+ provider_service = serializers.PrimaryKeyRelatedField(queryset=VTRService.objects.all(), default=get_default_vtr_service)
result = serializers.CharField(required=False)
result_code = serializers.CharField(required=False)
backend_status = ReadOnlyField()
@@ -56,7 +56,7 @@
base_name = "truckroll"
method_name = "truckroll"
method_kind = "viewset"
- queryset = VTRTenantForAPI.get_tenant_objects().all() # select_related().all()
+ queryset = VTRTenantForAPI.objects.all() # select_related().all()
serializer_class = VTRTenantSerializer
@classmethod
diff --git a/xos/attic/vtrtenant_model.py b/xos/attic/vtrtenant_model.py
index 6d3dba2..f2d24c3 100644
--- a/xos/attic/vtrtenant_model.py
+++ b/xos/attic/vtrtenant_model.py
@@ -1,7 +1,7 @@
sync_attributes = ( 'test', 'argument', "scope" )
def __init__(self, *args, **kwargs):
- vtr_services = VTRService.get_service_objects().all()
+ vtr_services = VTRService.objects.all()
if vtr_services:
self._meta.get_field("provider_service").default = vtr_services[0].id
super(VTRTenant, self).__init__(*args, **kwargs)