211 lines
4.8 KiB
Markdown
211 lines
4.8 KiB
Markdown
# Django Admin Cleanup - Implementation Status
|
|
|
|
## Status: COMPLETED (January 4, 2026)
|
|
|
|
---
|
|
|
|
## What Was Done
|
|
|
|
### 1. Fixed Duplicate Model Registration
|
|
**File:** `backend/igny8_core/business/billing/admin.py`
|
|
|
|
- `AccountPaymentMethod` was registered in BOTH:
|
|
- `modules/billing/admin.py` (with AccountAdminMixin - KEPT)
|
|
- `business/billing/admin.py` (simpler version - REMOVED)
|
|
- Commented out the duplicate registration in `business/billing/admin.py`
|
|
|
|
### 2. Simplified Admin Site Configuration
|
|
**File:** `backend/igny8_core/admin/site.py`
|
|
|
|
- Removed complex `get_app_list()` override (was 250+ lines)
|
|
- Removed `get_sidebar_list()` override
|
|
- Removed `each_context()` override with debug logging
|
|
- Kept only:
|
|
- Custom URLs for dashboard, reports, and monitoring
|
|
- Index redirect to dashboard
|
|
- Navigation is now handled by Unfold's built-in `SIDEBAR.navigation` setting
|
|
|
|
### 3. Added Proper Unfold Navigation Configuration
|
|
**File:** `backend/igny8_core/settings.py`
|
|
|
|
Added complete `UNFOLD["SIDEBAR"]["navigation"]` config with:
|
|
- Dashboard link
|
|
- Reports section (6 reports)
|
|
- Accounts & Users group
|
|
- Plans & Billing group
|
|
- Credits group
|
|
- Planning group
|
|
- Writing group
|
|
- Taxonomy group
|
|
- Publishing group
|
|
- Automation group
|
|
- AI Configuration group (NEW - consolidated)
|
|
- Global Settings group
|
|
- Resources group
|
|
- Logs & Monitoring group
|
|
- Django Admin group
|
|
|
|
Each item has proper Material Design icons.
|
|
|
|
### 4. Added Site Logo Configuration
|
|
**File:** `backend/igny8_core/settings.py`
|
|
|
|
```python
|
|
"SITE_ICON": {
|
|
"light": lambda request: "/static/admin/img/logo-light.svg",
|
|
"dark": lambda request: "/static/admin/img/logo-dark.svg",
|
|
},
|
|
```
|
|
|
|
**Note:** Logo SVG files need to be created at these paths for the logo to display.
|
|
|
|
---
|
|
|
|
## Verification Results
|
|
|
|
```bash
|
|
# Django system check
|
|
$ docker exec igny8_backend python manage.py check
|
|
System check identified no issues (0 silenced).
|
|
|
|
# Admin registry test
|
|
$ docker exec igny8_backend python manage.py shell -c "..."
|
|
Total registered models: 63
|
|
Admin site ready!
|
|
|
|
# UNFOLD config test
|
|
Navigation items: 20
|
|
```
|
|
|
|
---
|
|
|
|
## What Was NOT Done (and why)
|
|
|
|
### Models NOT Hidden from Admin
|
|
|
|
These models were originally planned for removal but are **actively used**:
|
|
|
|
| Model | Reason Kept |
|
|
|-------|-------------|
|
|
| `IntegrationSettings` | Used by AI functions, settings, integration views |
|
|
| `AIPrompt` | Used by ai/prompts.py, management commands |
|
|
| `AuthorProfile` | Used by content generation |
|
|
| `Strategy` | Used by content planning |
|
|
|
|
---
|
|
|
|
## Admin Sidebar Structure (Final)
|
|
|
|
```
|
|
Dashboard
|
|
Reports
|
|
├── Revenue
|
|
├── Usage
|
|
├── Content
|
|
├── Data Quality
|
|
├── Token Usage
|
|
└── AI Cost Analysis
|
|
|
|
─── Core ───
|
|
Accounts & Users
|
|
├── Accounts
|
|
├── Users
|
|
├── Sites
|
|
├── Sectors
|
|
└── Site Access
|
|
|
|
Plans & Billing
|
|
├── Plans
|
|
├── Subscriptions
|
|
├── Invoices
|
|
├── Payments
|
|
├── Credit Packages
|
|
└── Payment Methods
|
|
|
|
Credits
|
|
├── Transactions
|
|
├── Usage Log
|
|
└── Plan Limits
|
|
|
|
─── Content ───
|
|
Planning
|
|
├── Keywords
|
|
├── Clusters
|
|
└── Content Ideas
|
|
|
|
Writing
|
|
├── Tasks
|
|
├── Content
|
|
├── Images
|
|
└── Image Prompts
|
|
|
|
Taxonomy
|
|
├── Taxonomies
|
|
├── Relations
|
|
├── Attributes
|
|
└── Cluster Maps
|
|
|
|
─── Automation ───
|
|
Publishing
|
|
├── Integrations
|
|
├── Publishing Records
|
|
├── Deployments
|
|
└── Sync Events
|
|
|
|
Automation
|
|
├── Configs
|
|
└── Runs
|
|
|
|
─── Configuration ───
|
|
AI Configuration
|
|
├── AI Models
|
|
├── Credit Costs
|
|
├── Billing Config
|
|
└── AI Task Logs
|
|
|
|
Global Settings
|
|
├── Integration Settings
|
|
├── Module Settings
|
|
├── AI Prompts
|
|
├── Author Profiles
|
|
└── Strategies
|
|
|
|
Resources
|
|
├── Industries
|
|
├── Industry Sectors
|
|
└── Seed Keywords
|
|
|
|
─── System ───
|
|
Logs & Monitoring
|
|
├── System Health
|
|
├── API Monitor
|
|
├── Debug Console
|
|
├── Celery Tasks
|
|
└── Admin Log
|
|
|
|
Django Admin
|
|
├── Groups
|
|
├── Permissions
|
|
├── Content Types
|
|
└── Sessions
|
|
```
|
|
|
|
---
|
|
|
|
## Files Changed
|
|
|
|
| File | Change |
|
|
|------|--------|
|
|
| `backend/igny8_core/settings.py` | Added full UNFOLD navigation config |
|
|
| `backend/igny8_core/admin/site.py` | Simplified to ~60 lines (was ~350) |
|
|
| `backend/igny8_core/business/billing/admin.py` | Commented out duplicate AccountPaymentMethod |
|
|
|
|
---
|
|
|
|
## Next Steps (From Original Plan)
|
|
|
|
1. ✅ **Django Admin Cleanup** - DONE
|
|
2. ⏳ **Simplify AI Settings** - Merge content + image settings into AccountSettings
|
|
3. ⏳ **Create IntegrationProvider** - Move API keys to dedicated model
|
|
4. ⏳ **AIModelConfig Enhancement** - Add tokens_per_credit, credits_per_image, quality_tier
|