From 022a4ce5377bdd5f2468acb77d3b5e70985c1994 Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Tue, 23 Dec 2025 07:17:38 +0000 Subject: [PATCH] Register GlobalModuleSettings in admin --- backend/igny8_core/modules/system/admin.py | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/backend/igny8_core/modules/system/admin.py b/backend/igny8_core/modules/system/admin.py index c64b3554..5f58b00e 100644 --- a/backend/igny8_core/modules/system/admin.py +++ b/backend/igny8_core/modules/system/admin.py @@ -5,6 +5,7 @@ from django.contrib import admin from unfold.admin import ModelAdmin from igny8_core.admin.base import AccountAdminMixin, Igny8ModelAdmin from .models import AIPrompt, IntegrationSettings, AuthorProfile, Strategy +from .global_settings_models import GlobalModuleSettings from django.contrib import messages from import_export.admin import ExportMixin, ImportExportMixin @@ -312,4 +313,41 @@ class StrategyAdmin(ImportExportMixin, AccountAdminMixin, Igny8ModelAdmin): strategy_copy.save() count += 1 self.message_user(request, f'{count} strategy/strategies cloned.', messages.SUCCESS) - bulk_clone.short_description = 'Clone selected strategies' \ No newline at end of file + bulk_clone.short_description = 'Clone selected strategies' + + +@admin.register(GlobalModuleSettings) +class GlobalModuleSettingsAdmin(ModelAdmin): + """Admin for Global Module Settings (Singleton)""" + + list_display = [ + 'id', + 'planner_enabled', + 'writer_enabled', + 'thinker_enabled', + 'automation_enabled', + 'site_builder_enabled', + 'linker_enabled', + ] + + fieldsets = ( + ('Module Toggles', { + 'fields': ( + 'planner_enabled', + 'writer_enabled', + 'thinker_enabled', + 'automation_enabled', + 'site_builder_enabled', + 'linker_enabled', + ), + 'description': 'Platform-wide module enable/disable controls. Changes affect all accounts immediately.' + }), + ) + + def has_add_permission(self, request): + """Only allow one instance (singleton)""" + return not self.model.objects.exists() + + def has_delete_permission(self, request, obj=None): + """Prevent deletion of singleton""" + return False \ No newline at end of file