feat: add email notice and settings page but still have some issue

This commit is contained in:
2025-09-20 13:09:06 +08:00
parent 8f2ab9aeda
commit b715c8bb52
15 changed files with 1595 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
from django.contrib import admin
from .models import NotificationEmail, NotificationSettings
@admin.register(NotificationEmail)
class NotificationEmailAdmin(admin.ModelAdmin):
list_display = ('email', 'is_enabled', 'description', 'created_at')
list_filter = ('is_enabled', 'created_at')
search_fields = ('email', 'description')
list_editable = ('is_enabled',)
ordering = ('-created_at',)
@admin.register(NotificationSettings)
class NotificationSettingsAdmin(admin.ModelAdmin):
list_display = ('email_notification_enabled', 'updated_at')
def has_add_permission(self, request):
# 只允许存在一个设置实例
return not NotificationSettings.objects.exists()
def has_delete_permission(self, request, obj=None):
# 不允许删除设置
return False