django admin improvement complete

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-15 01:38:41 +00:00
parent cda56f15ba
commit 125489df0f
14 changed files with 526 additions and 68 deletions

View File

@@ -35,7 +35,7 @@ def revenue_report(request):
# Plan distribution
plan_distribution = Plan.objects.annotate(
account_count=Count('account')
account_count=Count('accounts')
).values('name', 'account_count')
# Payment method breakdown
@@ -213,7 +213,7 @@ def data_quality_report(request):
# Duplicate keywords
from igny8_core.modules.planner.models import Keywords
duplicates = Keywords.objects.values('keyword', 'site', 'sector').annotate(
duplicates = Keywords.objects.values('seed_keyword', 'site', 'sector').annotate(
count=Count('id')
).filter(count__gt=1).count()
if duplicates > 0:

View File

@@ -257,6 +257,44 @@ class Igny8AdminSite(UnfoldAdminSite):
'models': [],
})
# Add Reports section with links to all reports
organized_apps.append({
'name': 'Reports & Analytics',
'app_label': '_reports',
'app_url': '#',
'has_module_perms': True,
'models': [
{
'name': 'Revenue Report',
'object_name': 'RevenueReport',
'admin_url': '/admin/reports/revenue/',
'view_only': True,
'perms': {'view': True},
},
{
'name': 'Usage Report',
'object_name': 'UsageReport',
'admin_url': '/admin/reports/usage/',
'view_only': True,
'perms': {'view': True},
},
{
'name': 'Content Report',
'object_name': 'ContentReport',
'admin_url': '/admin/reports/content/',
'view_only': True,
'perms': {'view': True},
},
{
'name': 'Data Quality Report',
'object_name': 'DataQualityReport',
'admin_url': '/admin/reports/data-quality/',
'view_only': True,
'perms': {'view': True},
},
],
})
for group_name, group_config in custom_groups.items():
group_models = []