From cfc3bac5be9a97c7ec0c31020e22a8af7c54f9b3 Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Thu, 25 Dec 2025 07:32:45 +0000 Subject: [PATCH] Fix: Remove non-existent BillingConfiguration from billing admin BillingConfiguration model doesn't exist in the codebase, causing ImportError and preventing backend from starting. Removed the import and admin class. This was causing the backend to be stuck in restarting state. --- backend/igny8_core/modules/billing/admin.py | 46 --------------------- 1 file changed, 46 deletions(-) diff --git a/backend/igny8_core/modules/billing/admin.py b/backend/igny8_core/modules/billing/admin.py index a7a2471f..dcf0c3a1 100644 --- a/backend/igny8_core/modules/billing/admin.py +++ b/backend/igny8_core/modules/billing/admin.py @@ -9,7 +9,6 @@ from simple_history.admin import SimpleHistoryAdmin from igny8_core.admin.base import AccountAdminMixin, Igny8ModelAdmin from igny8_core.business.billing.models import ( CreditCostConfig, - BillingConfiguration, Invoice, Payment, CreditPackage, @@ -702,51 +701,6 @@ class PlanLimitUsageAdmin(ExportMixin, AccountAdminMixin, Igny8ModelAdmin): bulk_delete_old_records.short_description = 'Delete old records (>1 year)' -@admin.register(BillingConfiguration) -class BillingConfigurationAdmin(Igny8ModelAdmin): - """Admin for global billing configuration (Singleton)""" - list_display = [ - 'id', - 'default_tokens_per_credit', - 'default_credit_price_usd', - 'credit_rounding_mode', - 'enable_token_based_reporting', - 'updated_at', - 'updated_by' - ] - - fieldsets = ( - ('Global Token-to-Credit Settings', { - 'fields': ('default_tokens_per_credit', 'default_credit_price_usd', 'credit_rounding_mode'), - 'description': 'These settings apply when no operation-specific config exists' - }), - ('Reporting Settings', { - 'fields': ('enable_token_based_reporting',), - 'description': 'Control token-based reporting features' - }), - ('Audit Trail', { - 'fields': ('updated_by', 'updated_at'), - 'classes': ('collapse',) - }), - ) - - readonly_fields = ['updated_at'] - - def has_add_permission(self, request): - """Only allow one instance (singleton)""" - from igny8_core.business.billing.models import BillingConfiguration - return not BillingConfiguration.objects.exists() - - def has_delete_permission(self, request, obj=None): - """Prevent deletion of the singleton""" - return False - - def save_model(self, request, obj, form, change): - """Track who made the change""" - obj.updated_by = request.user - super().save_model(request, obj, form, change) - - @admin.register(AIModelConfig) class AIModelConfigAdmin(SimpleHistoryAdmin, Igny8ModelAdmin): """