Add ServiceInstance to admin
This commit is contained in:
parent
b6260b4e9e
commit
57945c8e51
1 changed files with 36 additions and 0 deletions
|
@ -13,6 +13,7 @@ from servala.core.models import (
|
|||
Service,
|
||||
ServiceCategory,
|
||||
ServiceDefinition,
|
||||
ServiceInstance,
|
||||
ServiceOffering,
|
||||
ServiceOfferingControlPlane,
|
||||
User,
|
||||
|
@ -220,6 +221,41 @@ class ServiceOfferingControlPlaneAdmin(admin.ModelAdmin):
|
|||
autocomplete_fields = ("service_offering", "control_plane", "service_definition")
|
||||
|
||||
|
||||
@admin.register(ServiceInstance)
|
||||
class ServiceInstanceAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "organization", "context", "created_by", "is_deleted")
|
||||
list_filter = ("organization", "context", "is_deleted")
|
||||
search_fields = (
|
||||
"name",
|
||||
"organization__name",
|
||||
"context__service_offering__service__name",
|
||||
)
|
||||
readonly_fields = ("name", "organization", "context")
|
||||
autocomplete_fields = ("organization", "context")
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
if obj: # If this is an edit (not a new instance)
|
||||
return self.readonly_fields
|
||||
return []
|
||||
|
||||
fieldsets = (
|
||||
(
|
||||
None,
|
||||
{
|
||||
"fields": (
|
||||
"name",
|
||||
"organization",
|
||||
"context",
|
||||
"created_by",
|
||||
"is_deleted",
|
||||
"deleted_at",
|
||||
"deleted_by",
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@admin.register(ServiceOffering)
|
||||
class ServiceOfferingAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "service", "provider")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue