aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar scragly <[email protected]>2020-09-20 07:06:40 +1000
committerGravatar scragly <[email protected]>2020-09-20 07:06:40 +1000
commita105de702d2f64a66acfc2f06a3b994cd46a5c3e (patch)
treec82797873c048b91b848e73f3d46a980e9a75372
parentAdd migrations for nomination and doc link model changes. (diff)
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.
-rw-r--r--pydis_site/apps/api/admin.py5
1 files changed, 5 insertions, 0 deletions
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):