Add write-once namespace to admin
This commit is contained in:
parent
2c65646146
commit
b8e9875772
1 changed files with 8 additions and 2 deletions
|
@ -56,12 +56,18 @@ class OrganizationMembershipInline(admin.TabularInline):
|
||||||
|
|
||||||
@admin.register(Organization)
|
@admin.register(Organization)
|
||||||
class OrganizationAdmin(admin.ModelAdmin):
|
class OrganizationAdmin(admin.ModelAdmin):
|
||||||
list_display = ("name", "billing_entity", "origin")
|
list_display = ("name", "namespace", "billing_entity", "origin")
|
||||||
list_filter = ("origin",)
|
list_filter = ("origin",)
|
||||||
search_fields = ("name",)
|
search_fields = ("name", "namespace")
|
||||||
autocomplete_fields = ("billing_entity", "origin")
|
autocomplete_fields = ("billing_entity", "origin")
|
||||||
inlines = (OrganizationMembershipInline,)
|
inlines = (OrganizationMembershipInline,)
|
||||||
|
|
||||||
|
def get_readonly_fields(self, request, obj=None):
|
||||||
|
readonly_fields = list(super().get_readonly_fields(request, obj) or [])
|
||||||
|
if obj: # If this is an edit (not a new organization)
|
||||||
|
readonly_fields.append("namespace")
|
||||||
|
return readonly_fields
|
||||||
|
|
||||||
|
|
||||||
@admin.register(BillingEntity)
|
@admin.register(BillingEntity)
|
||||||
class BillingEntityAdmin(admin.ModelAdmin):
|
class BillingEntityAdmin(admin.ModelAdmin):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue