latest 2 days work excluding problemetic code
This commit is contained in:
@@ -5,10 +5,6 @@ from django import forms
|
||||
from django.contrib import admin, messages
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from unfold.admin import ModelAdmin, TabularInline
|
||||
from unfold.contrib.filters.admin import (
|
||||
RelatedDropdownFilter,
|
||||
ChoicesDropdownFilter,
|
||||
)
|
||||
from simple_history.admin import SimpleHistoryAdmin
|
||||
from igny8_core.admin.base import AccountAdminMixin, Igny8ModelAdmin
|
||||
from .models import User, Account, Plan, Subscription, Site, Sector, SiteUserAccess, Industry, IndustrySector, SeedKeyword, PasswordResetToken
|
||||
@@ -132,12 +128,7 @@ class PlanAdmin(ImportExportMixin, Igny8ModelAdmin):
|
||||
resource_class = PlanResource
|
||||
"""Plan admin - Global, no account filtering needed"""
|
||||
list_display = ['name', 'slug', 'price', 'billing_cycle', 'max_sites', 'max_users', 'max_keywords', 'max_ahrefs_queries', 'included_credits', 'is_active', 'is_featured']
|
||||
list_filter = [
|
||||
('is_active', ChoicesDropdownFilter),
|
||||
('billing_cycle', ChoicesDropdownFilter),
|
||||
('is_internal', ChoicesDropdownFilter),
|
||||
('is_featured', ChoicesDropdownFilter),
|
||||
]
|
||||
list_filter = ['is_active', 'billing_cycle', 'is_internal', 'is_featured']
|
||||
search_fields = ['name', 'slug']
|
||||
readonly_fields = ['created_at']
|
||||
actions = [
|
||||
@@ -212,10 +203,7 @@ class AccountAdmin(ExportMixin, AccountAdminMixin, SimpleHistoryAdmin, Igny8Mode
|
||||
resource_class = AccountResource
|
||||
form = AccountAdminForm
|
||||
list_display = ['name', 'slug', 'owner', 'plan', 'status', 'health_indicator', 'credits', 'created_at']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('plan', RelatedDropdownFilter),
|
||||
]
|
||||
list_filter = ['status', 'plan']
|
||||
search_fields = ['name', 'slug']
|
||||
readonly_fields = ['created_at', 'updated_at', 'health_indicator', 'health_details']
|
||||
actions = [
|
||||
@@ -515,9 +503,7 @@ class SubscriptionResource(resources.ModelResource):
|
||||
class SubscriptionAdmin(ExportMixin, AccountAdminMixin, Igny8ModelAdmin):
|
||||
resource_class = SubscriptionResource
|
||||
list_display = ['account', 'status', 'current_period_start', 'current_period_end']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
]
|
||||
list_filter = ['status']
|
||||
search_fields = ['account__name', 'stripe_subscription_id']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
actions = [
|
||||
@@ -635,13 +621,7 @@ class SiteResource(resources.ModelResource):
|
||||
class SiteAdmin(ImportExportMixin, AccountAdminMixin, Igny8ModelAdmin):
|
||||
resource_class = SiteResource
|
||||
list_display = ['name', 'slug', 'account', 'industry', 'domain', 'status', 'is_active', 'get_api_key_status', 'get_sectors_count']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('is_active', ChoicesDropdownFilter),
|
||||
('account', RelatedDropdownFilter),
|
||||
('industry', RelatedDropdownFilter),
|
||||
('hosting_type', ChoicesDropdownFilter),
|
||||
]
|
||||
list_filter = ['status', 'is_active', 'account', 'industry', 'hosting_type']
|
||||
search_fields = ['name', 'slug', 'domain', 'industry__name']
|
||||
readonly_fields = ['created_at', 'updated_at', 'get_api_key_display']
|
||||
inlines = [SectorInline]
|
||||
@@ -784,12 +764,7 @@ class SectorResource(resources.ModelResource):
|
||||
class SectorAdmin(ExportMixin, AccountAdminMixin, Igny8ModelAdmin):
|
||||
resource_class = SectorResource
|
||||
list_display = ['name', 'slug', 'site', 'industry_sector', 'get_industry', 'status', 'is_active', 'get_keywords_count', 'get_clusters_count']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('is_active', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('industry_sector__industry', RelatedDropdownFilter),
|
||||
]
|
||||
list_filter = ['status', 'is_active', 'site', 'industry_sector__industry']
|
||||
search_fields = ['name', 'slug', 'site__name', 'industry_sector__name']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
actions = [
|
||||
@@ -1006,12 +981,7 @@ class SeedKeywordAdmin(ImportExportMixin, Igny8ModelAdmin):
|
||||
resource_class = SeedKeywordResource
|
||||
"""SeedKeyword admin - Global reference data, no account filtering"""
|
||||
list_display = ['keyword', 'industry', 'sector', 'volume', 'difficulty', 'country', 'is_active', 'created_at']
|
||||
list_filter = [
|
||||
('is_active', ChoicesDropdownFilter),
|
||||
('industry', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('country', ChoicesDropdownFilter),
|
||||
]
|
||||
list_filter = ['is_active', 'industry', 'sector', 'country']
|
||||
search_fields = ['keyword']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
actions = [
|
||||
@@ -1019,7 +989,6 @@ class SeedKeywordAdmin(ImportExportMixin, Igny8ModelAdmin):
|
||||
'bulk_deactivate',
|
||||
'bulk_update_country',
|
||||
]
|
||||
# Delete is handled by AdminDeleteMixin in base Igny8ModelAdmin
|
||||
|
||||
fieldsets = (
|
||||
('Keyword Info', {
|
||||
@@ -1119,12 +1088,7 @@ class UserAdmin(ExportMixin, BaseUserAdmin, Igny8ModelAdmin):
|
||||
"""
|
||||
resource_class = UserResource
|
||||
list_display = ['email', 'username', 'account', 'role', 'is_active', 'is_staff', 'created_at']
|
||||
list_filter = [
|
||||
('role', ChoicesDropdownFilter),
|
||||
('account', RelatedDropdownFilter),
|
||||
('is_active', ChoicesDropdownFilter),
|
||||
('is_staff', ChoicesDropdownFilter),
|
||||
]
|
||||
list_filter = ['role', 'account', 'is_active', 'is_staff']
|
||||
search_fields = ['email', 'username']
|
||||
readonly_fields = ['created_at', 'updated_at', 'password_display']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user