This commit is contained in:
IGNY8 VPS (Salman)
2025-11-30 05:06:43 +00:00
parent 8d47d6a555
commit 59e9cb4322
8 changed files with 465 additions and 2 deletions

View File

@@ -243,10 +243,16 @@ class IndustryAdmin(admin.ModelAdmin):
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()
get_sectors_count.short_description = 'Active Sectors'
def has_delete_permission(self, request, obj=None):
"""Allow deletion for superusers and developers"""
return request.user.is_superuser or (hasattr(request.user, 'is_developer') and request.user.is_developer())
@admin.register(IndustrySector)
@@ -255,6 +261,12 @@ class IndustrySectorAdmin(admin.ModelAdmin):
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"""
return request.user.is_superuser or (hasattr(request.user, 'is_developer') and request.user.is_developer())
@admin.register(SeedKeyword)
@@ -264,6 +276,8 @@ class SeedKeywordAdmin(admin.ModelAdmin):
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', {
@@ -276,6 +290,10 @@ class SeedKeywordAdmin(admin.ModelAdmin):
'fields': ('created_at', 'updated_at')
}),
)
def has_delete_permission(self, request, obj=None):
"""Allow deletion for superusers and developers"""
return request.user.is_superuser or (hasattr(request.user, 'is_developer') and request.user.is_developer())
@admin.register(User)