@@ -12,6 +12,7 @@ from igny8_core.business.billing.models import (
|
||||
Payment,
|
||||
CreditPackage,
|
||||
PaymentMethodConfig,
|
||||
PlanLimitUsage,
|
||||
)
|
||||
from .models import CreditTransaction, CreditUsageLog, AccountPaymentMethod
|
||||
from import_export.admin import ExportMixin
|
||||
@@ -493,3 +494,46 @@ class CreditCostConfigAdmin(ModelAdmin):
|
||||
obj.updated_by = request.user
|
||||
super().save_model(request, obj, form, change)
|
||||
|
||||
|
||||
@admin.register(PlanLimitUsage)
|
||||
class PlanLimitUsageAdmin(AccountAdminMixin, ModelAdmin):
|
||||
"""Admin for tracking plan limit usage across billing periods"""
|
||||
list_display = [
|
||||
'account',
|
||||
'limit_type',
|
||||
'amount_used',
|
||||
'period_display',
|
||||
'created_at',
|
||||
]
|
||||
list_filter = [
|
||||
'limit_type',
|
||||
('period_start', DateRangeFilter),
|
||||
('period_end', DateRangeFilter),
|
||||
'account',
|
||||
]
|
||||
search_fields = ['account__name']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
date_hierarchy = 'period_start'
|
||||
|
||||
fieldsets = (
|
||||
('Usage Info', {
|
||||
'fields': ('account', 'limit_type', 'amount_used')
|
||||
}),
|
||||
('Billing Period', {
|
||||
'fields': ('period_start', 'period_end')
|
||||
}),
|
||||
('Metadata', {
|
||||
'fields': ('metadata',),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
('Timestamps', {
|
||||
'fields': ('created_at', 'updated_at'),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
)
|
||||
|
||||
def period_display(self, obj):
|
||||
"""Display billing period range"""
|
||||
return f"{obj.period_start} to {obj.period_end}"
|
||||
period_display.short_description = 'Billing Period'
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib import messages
|
||||
from unfold.admin import ModelAdmin
|
||||
from unfold.contrib.filters.admin import (
|
||||
RangeDateFilter,
|
||||
RangeNumericFilter,
|
||||
RelatedDropdownFilter,
|
||||
ChoicesDropdownFilter,
|
||||
)
|
||||
from igny8_core.admin.base import SiteSectorAdminMixin
|
||||
from .models import Keywords, Clusters, ContentIdeas
|
||||
from import_export.admin import ExportMixin
|
||||
@@ -19,7 +25,13 @@ class KeywordsResource(resources.ModelResource):
|
||||
@admin.register(Clusters)
|
||||
class ClustersAdmin(SiteSectorAdminMixin, ModelAdmin):
|
||||
list_display = ['name', 'site', 'sector', 'keywords_count', 'volume', 'status', 'created_at']
|
||||
list_filter = ['status', 'site', 'sector']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('volume', RangeNumericFilter),
|
||||
('created_at', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['name']
|
||||
ordering = ['name']
|
||||
autocomplete_fields = ['site', 'sector']
|
||||
@@ -44,8 +56,17 @@ class ClustersAdmin(SiteSectorAdminMixin, ModelAdmin):
|
||||
class KeywordsAdmin(ExportMixin, SiteSectorAdminMixin, ModelAdmin):
|
||||
resource_class = KeywordsResource
|
||||
list_display = ['keyword', 'seed_keyword', 'site', 'sector', 'cluster', 'volume', 'difficulty', 'intent', 'status', 'created_at']
|
||||
list_filter = ['status', 'seed_keyword__intent', 'site', 'sector', 'seed_keyword__industry', 'seed_keyword__sector']
|
||||
search_fields = ['seed_keyword__keyword']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('intent', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('cluster', RelatedDropdownFilter),
|
||||
('volume', RangeNumericFilter),
|
||||
('difficulty', RangeNumericFilter),
|
||||
('created_at', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['keyword', 'seed_keyword__keyword']
|
||||
ordering = ['-created_at']
|
||||
autocomplete_fields = ['cluster', 'site', 'sector', 'seed_keyword']
|
||||
actions = [
|
||||
@@ -133,7 +154,16 @@ class KeywordsAdmin(ExportMixin, SiteSectorAdminMixin, ModelAdmin):
|
||||
@admin.register(ContentIdeas)
|
||||
class ContentIdeasAdmin(SiteSectorAdminMixin, ModelAdmin):
|
||||
list_display = ['idea_title', 'site', 'sector', 'description_preview', 'content_type', 'content_structure', 'status', 'keyword_cluster', 'estimated_word_count', 'created_at']
|
||||
list_filter = ['status', 'content_type', 'content_structure', 'site', 'sector']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('content_type', ChoicesDropdownFilter),
|
||||
('content_structure', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('keyword_cluster', RelatedDropdownFilter),
|
||||
('estimated_word_count', RangeNumericFilter),
|
||||
('created_at', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['idea_title', 'target_keywords', 'description']
|
||||
ordering = ['-created_at']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib import messages
|
||||
from unfold.admin import ModelAdmin, TabularInline
|
||||
from unfold.contrib.filters.admin import (
|
||||
RangeDateFilter,
|
||||
RangeNumericFilter,
|
||||
RelatedDropdownFilter,
|
||||
ChoicesDropdownFilter,
|
||||
)
|
||||
from igny8_core.admin.base import SiteSectorAdminMixin
|
||||
from .models import Tasks, Images, Content
|
||||
from igny8_core.business.content.models import ContentTaxonomy, ContentAttribute, ContentTaxonomyRelation, ContentClusterMap
|
||||
@@ -30,7 +36,15 @@ class TaskResource(resources.ModelResource):
|
||||
class TasksAdmin(ExportMixin, SiteSectorAdminMixin, ModelAdmin):
|
||||
resource_class = TaskResource
|
||||
list_display = ['title', 'content_type', 'content_structure', 'site', 'sector', 'status', 'cluster', 'created_at']
|
||||
list_filter = ['status', 'content_type', 'content_structure', 'site', 'sector', 'cluster']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('content_type', ChoicesDropdownFilter),
|
||||
('content_structure', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('cluster', RelatedDropdownFilter),
|
||||
('created_at', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['title', 'description']
|
||||
ordering = ['-created_at']
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
@@ -186,9 +200,19 @@ class ContentResource(resources.ModelResource):
|
||||
@admin.register(Content)
|
||||
class ContentAdmin(ExportMixin, SiteSectorAdminMixin, ModelAdmin):
|
||||
resource_class = ContentResource
|
||||
list_display = ['title', 'content_type', 'content_structure', 'site', 'sector', 'source', 'status', 'get_taxonomy_count', 'created_at']
|
||||
list_filter = ['content_type', 'content_structure', 'source', 'status', 'site', 'sector', 'created_at']
|
||||
search_fields = ['title', 'content_html', 'external_url']
|
||||
list_display = ['title', 'content_type', 'content_structure', 'site', 'sector', 'source', 'status', 'word_count', 'get_taxonomy_count', 'created_at']
|
||||
list_filter = [
|
||||
('status', ChoicesDropdownFilter),
|
||||
('content_type', ChoicesDropdownFilter),
|
||||
('content_structure', ChoicesDropdownFilter),
|
||||
('source', ChoicesDropdownFilter),
|
||||
('site', RelatedDropdownFilter),
|
||||
('sector', RelatedDropdownFilter),
|
||||
('cluster', RelatedDropdownFilter),
|
||||
('word_count', RangeNumericFilter),
|
||||
('created_at', RangeDateFilter),
|
||||
]
|
||||
search_fields = ['title', 'content_html', 'external_url', 'meta_title', 'primary_keyword']
|
||||
ordering = ['-created_at']
|
||||
readonly_fields = ['created_at', 'updated_at', 'word_count', 'get_tags_display', 'get_categories_display']
|
||||
autocomplete_fields = ['cluster', 'site', 'sector']
|
||||
|
||||
Reference in New Issue
Block a user