CORD-879 eliminate proxy models in vtr service

Change-Id: Iab26025c87b18c26c83b5857138a17fc3b04b10d
diff --git a/xos/admin.py b/xos/admin.py
index 4e7de44..24bad70 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -19,6 +19,7 @@
 from django.contrib.admin.views.main import ChangeList
 from django.core.urlresolvers import reverse
 from django.contrib.admin.utils import quote
+from django.contrib.contenttypes.models import ContentType
 
 class VTRServiceAdmin(ReadOnlyAwareAdmin):
     model = VTRService
@@ -48,42 +49,23 @@
         return VTRService.get_service_objects_by_user(request.user)
 
 class VTRTenantForm(forms.ModelForm):
-    test = forms.ChoiceField(choices=VTRTenant.TEST_CHOICES, required=True)
-    scope = forms.ChoiceField(choices=VTRTenant.SCOPE_CHOICES, required=True)
-    argument = forms.CharField(required=False)
-    result_code = forms.CharField(required=False)
-    result = forms.CharField(required=False, widget=forms.Textarea(attrs={'rows': 10, 'cols': 80, 'class': 'input-xxlarge'}))
     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()
         if self.instance:
-            # fields for the attributes
-            self.fields['test'].initial = self.instance.test
-            self.fields['argument'].initial = self.instance.argument
-            self.fields['target'].initial = self.instance.target
-            self.fields['scope'].initial = self.instance.scope
-            if (self.instance.enacted is not None) and (self.instance.enacted >= self.instance.updated):
-                self.fields['result'].initial = self.instance.result
-                self.fields['result_code'].initial = self.instance.result_code
-            else:
-                self.fields['result'].initial = ""
-                self.fields['result_code'].initial= ""
+            if self.instance.target_id:
+                self.fields["target"].initial = CordSubscriberRoot.objects.get(id=self.instance.target_id)
         if (not self.instance) or (not self.instance.pk):
-            # default fields for an 'add' form
             self.fields['kind'].initial = VTR_KIND
-            self.fields["scope"].initial = VTRTenant.get_default_attribute("scope")
             if VTRService.get_service_objects().exists():
                self.fields["provider_service"].initial = VTRService.get_service_objects().all()[0]
 
     def save(self, commit=True):
-        self.instance.test = self.cleaned_data.get("test")
-        self.instance.argument = self.cleaned_data.get("argument")
-        self.instance.target = self.cleaned_data.get("target")
-        self.instance.result = self.cleaned_data.get("result")
-        self.instance.result_code = self.cleaned_data.get("result_code")
-        self.instance.scope = self.cleaned_data.get("scope")
+        if self.cleaned_data.get("target"):
+            self.instance.target_type = ContentType.objects.get_for_model(CordSubscriberRoot)
+            self.instance.target_id = self.cleaned_data.get("target").id
         return super(VTRTenantForm, self).save(commit=commit)
 
     class Meta:
@@ -93,7 +75,7 @@
 class VTRTenantAdmin(ReadOnlyAwareAdmin):
     list_display = ('backend_status_icon', 'id', 'target', 'test', 'argument' )
     list_display_links = ('backend_status_icon', 'id')
-    fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', # 'subscriber_root', 'service_specific_id', 'service_specific_attribute',
+    fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service',
                                      'target', 'scope', 'test', 'argument', 'is_synced', 'result_code', 'result'],
                           'classes':['suit-tab suit-tab-general']})]
     readonly_fields = ('backend_status_text', 'service_specific_attribute', 'is_synced')