add bbs_url and client_network_label to VCPEService and its admin
diff --git a/xos/cord/admin.py b/xos/cord/admin.py
index 3bdb250..93bd8f5 100644
--- a/xos/cord/admin.py
+++ b/xos/cord/admin.py
@@ -87,15 +87,35 @@
# vCPE
#-----------------------------------------------------------------------------
+class VCPEServiceForm(forms.ModelForm):
+ bbs_url = forms.CharField()
+ client_network_label = forms.CharField()
+
+ def __init__(self,*args,**kwargs):
+ super (VCPEServiceForm,self ).__init__(*args,**kwargs)
+ if self.instance:
+ self.fields['bbs_url'].initial = self.instance.bbs_url
+ self.fields['client_network_label'].initial = self.instance.client_network_label
+
+ def save(self, commit=True):
+ self.instance.bbs_url = self.cleaned_data.get("bbs_url")
+ self.instance.client_network_label = self.cleaned_data.get("client_network_label")
+ return super(VCPEServiceForm, self).save(commit=commit)
+
+ class Meta:
+ model = VCPEService
+
class VCPEServiceAdmin(ReadOnlyAwareAdmin):
model = VCPEService
verbose_name = "vCPE Service"
verbose_name_plural = "vCPE Service"
list_display = ("backend_status_icon", "name", "enabled")
list_display_links = ('backend_status_icon', 'name', )
- fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url","icon_url" ], 'classes':['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', )
+ fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url", "icon_url", "service_specific_attribute",
+ "bbs_url", "client_network_label" ], 'classes':['suit-tab suit-tab-general']})]
+ readonly_fields = ('backend_status_text', "service_specific_attribute")
inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]
+ form = VCPEServiceForm
extracontext_registered_admins = True
diff --git a/xos/cord/models.py b/xos/cord/models.py
index 5a81109..15287b8 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -408,6 +408,12 @@
class VCPEService(Service):
KIND = VCPE_KIND
+ simple_attributes = ( ("bbs_url", None),
+ ("client_network_label", "hpc_client") )
+
+ def __init__(self, *args, **kwargs):
+ super(VCPEService, self).__init__(*args, **kwargs)
+
class Meta:
app_label = "cord"
verbose_name = "vCPE Service"
@@ -427,6 +433,9 @@
raise XOSConfigurationError("We've run out of available broadbandshield accounts. Delete some vcpe and try again.")
+VCPEService.setup_simple_attributes()
+
+
class VCPETenant(Tenant):
class Meta:
proxy = True