From a105de702d2f64a66acfc2f06a3b994cd46a5c3e Mon Sep 17 00:00:00 2001 From: scragly <29337040+scragly@users.noreply.github.com> Date: Sun, 20 Sep 2020 07:06:40 +1000 Subject: Remove delete permission for bot settings admin. I'm unable to see any cases where this would be wanted, and instead accidental deletion would result in the system possibly breaking, as we are unable to add the setting again to replace it if it got removed. The name has also set to read only in item view, to prevent renames, effectively doing the same thing as deleting it. --- pydis_site/apps/api/admin.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/admin.py b/pydis_site/apps/api/admin.py index c3f1179e..5093e605 100644 --- a/pydis_site/apps/api/admin.py +++ b/pydis_site/apps/api/admin.py @@ -33,11 +33,16 @@ class BotSettingAdmin(admin.ModelAdmin): fields = ("name", "data") list_display = ("name",) + readonly_fields = ("name",) def has_add_permission(self, *args) -> bool: """Prevent adding from django admin.""" return False + def has_delete_permission(self, *args) -> bool: + """Prevent deleting from django admin.""" + return False + @admin.register(DocumentationLink) class DocumentationLinkAdmin(admin.ModelAdmin): -- cgit v1.2.3