def queryset(self, request):
return ControllerPrivilege.select_by_user(request.user)
+class ControllerSiteInline(PlStackTabularInline):
+ model = ControllerSite
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-admin-only'
+ fields = ['controller', 'site_deployment', 'tenant_id']
+
+
class SitePrivilegeInline(PlStackTabularInline):
model = SitePrivilege
extra = 0
def queryset(self, request):
return SitePrivilege.select_by_user(request.user)
-class SiteDeploymentsInline(PlStackTabularInline):
- model = SiteDeployments
+class SiteDeploymentInline(PlStackTabularInline):
+ model = SiteDeployment
extra = 0
suit_classes = 'suit-tab suit-tab-deployments'
fields = ['backend_status_icon', 'deployment','site', 'controller']
if db_field.name == 'controller':
kwargs['queryset'] = Controller.select_by_user(request.user)
- return super(SiteDeploymentsInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
+ return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
def queryset(self, request):
- return SiteDeployments.select_by_user(request.user)
+ return SiteDeployment.select_by_user(request.user)
class SlicePrivilegeInline(PlStackTabularInline):
# create/destroy the through models ourselves. There has to be
# a better way...
- self.manipulate_m2m_objs(deployment, self.cleaned_data['sites'], deployment.sitedeployments.all(), SiteDeployments, "deployment", "site")
+ self.manipulate_m2m_objs(deployment, self.cleaned_data['sites'], deployment.sitedeployments.all(), SiteDeployment, "deployment", "site")
self.manipulate_m2m_objs(deployment, self.cleaned_data['images'], deployment.imagedeployments.all(), ImageDeployments, "deployment", "image")
# manipulate_m2m_objs doesn't work for Flavor/Deployment relationship
# so well handle that manually here
class ControllerAdminForm(forms.ModelForm):
site_deployments = forms.ModelMultipleChoiceField(
- queryset=SiteDeployments.objects.all(),
+ queryset=SiteDeployment.objects.all(),
required=False,
help_text="Select which sites deployments are managed by this controller",
widget=FilteredSelectMultiple(
# save_m2m() doesn't seem to work with 'through' relations. So we
# create/destroy the through models ourselves. There has to be
# a better way...
- #self.manipulate_m2m_objs(controller, self.cleaned_data['site_deployments'], controller.controllersitedeployments.all(), ControllerSiteDeployments, "controller", "site_deployment")
+ self.manipulate_m2m_objs(controller, self.cleaned_data['site_deployments'], controller.controllersitedeployments.all(), ControllerSite, "controller", "site_deployment")
pass
self.save_m2m()
model = Controller
fieldList = ['name', 'version', 'backend_type', 'auth_url', 'admin_user', 'admin_tenant','admin_password']
#fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-general']})]
- inlines = [] # ,ControllerImagesInline]
+ inlines = [ControllerSiteInline] # ,ControllerImagesInline]
list_display = ['backend_status_icon', 'name', 'version', 'backend_type']
list_display_links = ('backend_status_icon', 'name', )
readonly_fields = ('backend_status_text',)
list_display = ('backend_status_icon', 'name', 'login_base','site_url', 'enabled')
list_display_links = ('backend_status_icon', 'name', )
filter_horizontal = ('deployments',)
- inlines = [SliceInline,UserInline,TagInline, SitePrivilegeInline, SiteDeploymentsInline]
+ inlines = [SliceInline,UserInline,TagInline, SitePrivilegeInline, SiteDeploymentInline]
search_fields = ['name']
def queryset(self, request):
raise forms.ValidationError('slice name must begin with %s' % site.login_base)
return cleaned_data
-class ControllerSlicesInline(PlStackTabularInline):
- model = ControllerSlices
+class ControllerSliceInline(PlStackTabularInline):
+ model = ControllerSlice
extra = 0
verbose_name = "Controller Slices"
verbose_name_plural = "Controller Slices"
list_display = ('backend_status_icon', 'name', 'site','serviceClass', 'slice_url', 'max_slivers')
list_display_links = ('backend_status_icon', 'name', )
inlines = [SlicePrivilegeInline,SliverInline, TagInline, ReservationInline,SliceNetworkInline]
- admin_inlines = [ControllerSlicesInline]
+ admin_inlines = [ControllerSliceInline]
user_readonly_fields = fieldList
fields = ['backend_status_icon', 'network','slice']
readonly_fields = ('backend_status_icon', )
-class ControllerNetworksInline(PlStackTabularInline):
- model = ControllerNetworks
+class ControllerNetworkInline(PlStackTabularInline):
+ model = ControllerNetwork
extra = 0
verbose_name_plural = "Controller Networks"
verbose_name = "Controller Network"
readonly_fields = ("subnet", )
inlines = [NetworkParameterInline, NetworkSliversInline, NetworkSlicesInline, RouterInline]
- admin_inlines = [ControllerNetworksInline]
+ admin_inlines = [ControllerNetworkInline]
form=NetworkForm