Refactor vBBU from 2.0 to 3.0, not for master
Change-Id: Ib2d68852ad4065d8c34599dca731123ed6297e84
diff --git a/xos/admin.py b/xos/admin.py
index 5b8071c..ef7503f 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -1,10 +1,11 @@
from core.admin import ReadOnlyAwareAdmin, SliceInline
from core.middleware import get_request
-from core.models import User
+# from core.models import User
from django import forms
from django.contrib import admin
-from services.vbbu.models import MCORDService, VBBUComponent, MCORD_KIND
+# from services.vbbu.models import *
+from synchronizers.new_base.modelaccessor import *
# The class to provide an admin interface on the web for the service.
# We do only configuration here and don't change any logic because the logic
@@ -72,7 +73,7 @@
# service because tenants vary more than services and there isn't a common form.
# This allows us to change the python behavior for the admin form to save extra
# fields and control defaults.
-class VBBUComponentForm(forms.ModelForm):
+class VBBUTenantForm(forms.ModelForm):
# Defines a field for the creator of this service. It is a dropdown which
# is populated with all of the users.
creator = forms.ModelChoiceField(queryset=User.objects.all())
@@ -80,7 +81,7 @@
display_message = forms.CharField(required=False)
def __init__(self, *args, **kwargs):
- super(VBBUComponentForm, self).__init__(*args, **kwargs)
+ super(VBBUTenantForm, self).__init__(*args, **kwargs)
# Set the kind field to readonly
self.fields['kind'].widget.attrs['readonly'] = True
# Define the logic for obtaining the objects for the provider_service
@@ -109,17 +110,17 @@
self.instance.creator = self.cleaned_data.get("creator")
self.instance.display_message = self.cleaned_data.get(
"display_message")
- return super(VBBUComponentForm, self).save(commit=commit)
+ return super(VBBUTenantForm, self).save(commit=commit)
class Meta:
- model = VBBUComponent
+ model = VBBUTenant
fields = '__all__'
# Define the admin form for the tenant. This uses a similar structure as the
# service but uses HelloWorldTenantCompleteForm to change the python behavior.
-class VBBUComponentAdmin(ReadOnlyAwareAdmin):
+class VBBUTenantAdmin(ReadOnlyAwareAdmin):
verbose_name = "vBBU Component"
verbose_name_plural = "vBBU Components"
list_display = ('id', 'backend_status_icon', 'instance', 'display_message')
@@ -130,14 +131,14 @@
'display_message'],
'classes': ['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', 'instance',)
- form = VBBUComponentForm
+ form = VBBUTenantForm
suit_form_tabs = (('general', 'Details'),)
def queryset(self, request):
- return VBBUComponent.get_tenant_objects_by_user(request.user)
+ return VBBUTenant.get_tenant_objects_by_user(request.user)
# Associate the admin forms with the models.
admin.site.register(MCORDService, MCORDServiceAdmin)
-admin.site.register(VBBUComponent, VBBUComponentAdmin)
+admin.site.register(VBBUTenant, VBBUTenantAdmin)