lamost fully fixed umfold template
This commit is contained in:
@@ -4,6 +4,7 @@ Admin interface for auth models
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from unfold.admin import ModelAdmin
|
||||
from igny8_core.admin.base import AccountAdminMixin
|
||||
from .models import User, Account, Plan, Subscription, Site, Sector, SiteUserAccess, Industry, IndustrySector, SeedKeyword, PasswordResetToken
|
||||
|
||||
@@ -109,7 +110,7 @@ class AccountAdminForm(forms.ModelForm):
|
||||
|
||||
|
||||
@admin.register(Plan)
|
||||
class PlanAdmin(admin.ModelAdmin):
|
||||
class PlanAdmin(ModelAdmin):
|
||||
"""Plan admin - Global, no account filtering needed"""
|
||||
list_display = ['name', 'slug', 'price', 'billing_cycle', 'max_sites', 'max_users', 'max_keywords', 'max_content_words', 'included_credits', 'is_active', 'is_featured']
|
||||
list_filter = ['is_active', 'billing_cycle', 'is_internal', 'is_featured']
|
||||
@@ -143,7 +144,7 @@ class PlanAdmin(admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(Account)
|
||||
class AccountAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
form = AccountAdminForm
|
||||
list_display = ['name', 'slug', 'owner', 'plan', 'status', 'health_indicator', 'credits', 'created_at']
|
||||
list_filter = ['status', 'plan']
|
||||
@@ -306,7 +307,7 @@ class AccountAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(Subscription)
|
||||
class SubscriptionAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
class SubscriptionAdmin(AccountAdminMixin, ModelAdmin):
|
||||
list_display = ['account', 'status', 'current_period_start', 'current_period_end']
|
||||
list_filter = ['status']
|
||||
search_fields = ['account__name', 'stripe_subscription_id']
|
||||
@@ -314,7 +315,7 @@ class SubscriptionAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(PasswordResetToken)
|
||||
class PasswordResetTokenAdmin(admin.ModelAdmin):
|
||||
class PasswordResetTokenAdmin(ModelAdmin):
|
||||
list_display = ['user', 'token', 'used', 'expires_at', 'created_at']
|
||||
list_filter = ['used', 'expires_at', 'created_at']
|
||||
search_fields = ['user__email', 'token']
|
||||
@@ -352,7 +353,7 @@ class SectorInline(admin.TabularInline):
|
||||
|
||||
|
||||
@admin.register(Site)
|
||||
class SiteAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
class SiteAdmin(AccountAdminMixin, ModelAdmin):
|
||||
list_display = ['name', 'slug', 'account', 'industry', 'domain', 'status', 'is_active', 'get_api_key_status', 'get_sectors_count']
|
||||
list_filter = ['status', 'is_active', 'account', 'industry', 'hosting_type']
|
||||
search_fields = ['name', 'slug', 'domain', 'industry__name']
|
||||
@@ -431,7 +432,7 @@ class SiteAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(Sector)
|
||||
class SectorAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
class SectorAdmin(AccountAdminMixin, ModelAdmin):
|
||||
list_display = ['name', 'slug', 'site', 'industry_sector', 'get_industry', 'status', 'is_active', 'get_keywords_count', 'get_clusters_count']
|
||||
list_filter = ['status', 'is_active', 'site', 'industry_sector__industry']
|
||||
search_fields = ['name', 'slug', 'site__name', 'industry_sector__name']
|
||||
@@ -469,7 +470,7 @@ class SectorAdmin(AccountAdminMixin, admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(SiteUserAccess)
|
||||
class SiteUserAccessAdmin(admin.ModelAdmin):
|
||||
class SiteUserAccessAdmin(ModelAdmin):
|
||||
list_display = ['user', 'site', 'granted_at', 'granted_by']
|
||||
list_filter = ['granted_at']
|
||||
search_fields = ['user__email', 'site__name']
|
||||
@@ -485,14 +486,13 @@ class IndustrySectorInline(admin.TabularInline):
|
||||
|
||||
|
||||
@admin.register(Industry)
|
||||
class IndustryAdmin(admin.ModelAdmin):
|
||||
class IndustryAdmin(ModelAdmin):
|
||||
list_display = ['name', 'slug', 'is_active', 'get_sectors_count', 'created_at']
|
||||
list_filter = ['is_active']
|
||||
search_fields = ['name', 'slug', 'description']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
inlines = [IndustrySectorInline]
|
||||
actions = ['delete_selected'] # Enable bulk delete
|
||||
change_list_template = 'admin/igny8_core_auth/industry/change_list.html'
|
||||
|
||||
def get_sectors_count(self, obj):
|
||||
return obj.sectors.filter(is_active=True).count()
|
||||
@@ -504,13 +504,12 @@ class IndustryAdmin(admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(IndustrySector)
|
||||
class IndustrySectorAdmin(admin.ModelAdmin):
|
||||
class IndustrySectorAdmin(ModelAdmin):
|
||||
list_display = ['name', 'slug', 'industry', 'is_active']
|
||||
list_filter = ['is_active', 'industry']
|
||||
search_fields = ['name', 'slug', 'description']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
actions = ['delete_selected'] # Enable bulk delete
|
||||
change_list_template = 'admin/igny8_core_auth/industrysector/change_list.html'
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
"""Allow deletion for superusers and developers"""
|
||||
@@ -518,14 +517,13 @@ class IndustrySectorAdmin(admin.ModelAdmin):
|
||||
|
||||
|
||||
@admin.register(SeedKeyword)
|
||||
class SeedKeywordAdmin(admin.ModelAdmin):
|
||||
class SeedKeywordAdmin(ModelAdmin):
|
||||
"""SeedKeyword admin - Global reference data, no account filtering"""
|
||||
list_display = ['keyword', 'industry', 'sector', 'volume', 'difficulty', 'intent', 'is_active', 'created_at']
|
||||
list_filter = ['is_active', 'industry', 'sector', 'intent']
|
||||
search_fields = ['keyword']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
actions = ['delete_selected'] # Enable bulk delete
|
||||
change_list_template = 'admin/igny8_core_auth/seedkeyword/change_list.html'
|
||||
|
||||
fieldsets = (
|
||||
('Keyword Info', {
|
||||
|
||||
Reference in New Issue
Block a user