unforld 1 not health yet
This commit is contained in:
@@ -28,6 +28,9 @@ class Igny8AdminConfig(AdminConfig):
|
||||
|
||||
def ready(self):
|
||||
super().ready()
|
||||
# Import Unfold AFTER apps are ready
|
||||
from unfold.admin import ModelAdmin as UnfoldModelAdmin
|
||||
|
||||
# Register Django internals in admin (read-only where appropriate)
|
||||
from django.contrib.admin.models import LogEntry
|
||||
from django.contrib.auth.models import Group, Permission
|
||||
@@ -35,8 +38,8 @@ class Igny8AdminConfig(AdminConfig):
|
||||
from django.contrib.sessions.models import Session
|
||||
|
||||
_safe_register(LogEntry, ReadOnlyAdmin)
|
||||
_safe_register(Permission, admin.ModelAdmin)
|
||||
_safe_register(Group, admin.ModelAdmin)
|
||||
_safe_register(Permission, UnfoldModelAdmin)
|
||||
_safe_register(Group, UnfoldModelAdmin)
|
||||
_safe_register(ContentType, ReadOnlyAdmin)
|
||||
_safe_register(Session, ReadOnlyAdmin)
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
"""
|
||||
Celery Task Monitoring Admin
|
||||
Celery Task Monitoring Admin - Unfold Style
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.utils.html import format_html
|
||||
from django.contrib import messages
|
||||
from django_celery_results.models import TaskResult
|
||||
from rangefilter.filters import DateRangeFilter
|
||||
from unfold.admin import ModelAdmin
|
||||
from unfold.contrib.filters.admin import RangeDateFilter
|
||||
|
||||
|
||||
class CeleryTaskResultAdmin(admin.ModelAdmin):
|
||||
"""Admin interface for monitoring Celery tasks"""
|
||||
class CeleryTaskResultAdmin(ModelAdmin):
|
||||
"""Admin interface for monitoring Celery tasks with Unfold styling"""
|
||||
|
||||
list_display = [
|
||||
'task_id',
|
||||
@@ -22,8 +23,8 @@ class CeleryTaskResultAdmin(admin.ModelAdmin):
|
||||
list_filter = [
|
||||
'status',
|
||||
'task_name',
|
||||
('date_created', DateRangeFilter),
|
||||
('date_done', DateRangeFilter),
|
||||
('date_created', RangeDateFilter),
|
||||
('date_done', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['task_id', 'task_name', 'task_args']
|
||||
readonly_fields = [
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
"""
|
||||
Custom AdminSite for IGNY8 to organize models into proper groups
|
||||
Custom AdminSite for IGNY8 to organize models into proper groups using Unfold
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin.apps import AdminConfig
|
||||
from django.apps import apps
|
||||
from django.urls import path
|
||||
from django.urls import path, reverse_lazy
|
||||
from django.shortcuts import redirect
|
||||
from unfold.admin import ModelAdmin as UnfoldModelAdmin
|
||||
from unfold.sites import UnfoldAdminSite
|
||||
|
||||
|
||||
class Igny8AdminSite(admin.AdminSite):
|
||||
class Igny8AdminSite(UnfoldAdminSite):
|
||||
"""
|
||||
Custom AdminSite that organizes models into the planned groups:
|
||||
1. Billing & Tenancy
|
||||
2. Sites & Users
|
||||
3. Global Reference Data
|
||||
4. Planner
|
||||
5. Writer Module
|
||||
6. Thinker Module
|
||||
7. System Configuration
|
||||
Custom AdminSite based on Unfold that organizes models into the planned groups
|
||||
"""
|
||||
site_header = 'IGNY8 Administration'
|
||||
site_title = 'IGNY8 Admin'
|
||||
|
||||
@@ -36,6 +36,11 @@ ALLOWED_HOSTS = [
|
||||
]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# Django Unfold admin theme - MUST be before django.contrib.admin
|
||||
'unfold',
|
||||
'unfold.contrib.filters',
|
||||
'unfold.contrib.import_export',
|
||||
'unfold.contrib.simple_history',
|
||||
# Core Django apps - Custom admin with IGNY8 branding
|
||||
'igny8_core.admin.apps.Igny8AdminConfig', # Custom admin config
|
||||
'django.contrib.auth',
|
||||
@@ -51,6 +56,7 @@ INSTALLED_APPS = [
|
||||
'import_export',
|
||||
'rangefilter',
|
||||
'django_celery_results',
|
||||
'simple_history',
|
||||
# IGNY8 apps
|
||||
'igny8_core.auth.apps.Igny8CoreAuthConfig', # Use app config with custom label
|
||||
'igny8_core.ai.apps.AIConfig', # AI Framework
|
||||
@@ -108,6 +114,7 @@ MIDDLEWARE = [
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'simple_history.middleware.HistoryRequestMiddleware', # Audit trail
|
||||
'igny8_core.middleware.request_id.RequestIDMiddleware', # Request ID tracking (must be early)
|
||||
'igny8_core.auth.middleware.AccountContextMiddleware', # Multi-account support
|
||||
# AccountContextMiddleware sets request.account from JWT
|
||||
@@ -607,6 +614,40 @@ CELERY_CACHE_BACKEND = 'django-cache'
|
||||
# Import/Export Settings
|
||||
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
||||
|
||||
# ==============================================================================
|
||||
# UNFOLD ADMIN CONFIGURATION
|
||||
# ==============================================================================
|
||||
# Modern Django admin theme with advanced features
|
||||
# Documentation: https://unfoldadmin.com/
|
||||
|
||||
UNFOLD = {
|
||||
"SITE_TITLE": "IGNY8 Administration",
|
||||
"SITE_HEADER": "IGNY8 Admin",
|
||||
"SITE_URL": "/",
|
||||
"SITE_SYMBOL": "speed", # Symbol from Material icons
|
||||
"SHOW_HISTORY": True, # Show history for models with simple_history
|
||||
"SHOW_VIEW_ON_SITE": True, # Show "View on site" button
|
||||
"COLORS": {
|
||||
"primary": {
|
||||
"50": "248 250 252",
|
||||
"100": "241 245 249",
|
||||
"200": "226 232 240",
|
||||
"300": "203 213 225",
|
||||
"400": "148 163 184",
|
||||
"500": "100 116 139",
|
||||
"600": "71 85 105",
|
||||
"700": "51 65 85",
|
||||
"800": "30 41 59",
|
||||
"900": "15 23 42",
|
||||
"950": "2 6 23",
|
||||
},
|
||||
},
|
||||
"SIDEBAR": {
|
||||
"show_search": True, # Show search in sidebar
|
||||
"show_all_applications": True, # Show all apps (we'll organize via custom get_app_list)
|
||||
},
|
||||
}
|
||||
|
||||
# Billing / Payments configuration
|
||||
STRIPE_PUBLIC_KEY = os.getenv('STRIPE_PUBLIC_KEY', '')
|
||||
STRIPE_SECRET_KEY = os.getenv('STRIPE_SECRET_KEY', '')
|
||||
|
||||
Reference in New Issue
Block a user