1 from django.contrib import admin
2 from .models import EmailTemplate, EmailSent
5 class EmailSentInline(admin.TabularInline):
7 fields = ['timestamp', 'email', 'subject']
8 readonly_fields = ['timestamp', 'email', 'subject']
11 show_change_link = True
13 def has_add_permission(self, request, obj):
17 class EmailTemplateAdmin(admin.ModelAdmin):
18 list_display = ['state', 'days', 'subject', 'hour']
19 inlines = [EmailSentInline]
22 admin.site.register(EmailTemplate, EmailTemplateAdmin)
25 class EmailSentAdmin(admin.ModelAdmin):
26 list_filter = ['template']
27 list_display = ['timestamp', 'template', 'email', 'subject']
28 fields = ['timestamp', 'template', 'email', 'subject', 'body', 'hash_value']
29 readonly_fields = fields
30 change_links = ['template']
33 admin.site.register(EmailSent, EmailSentAdmin)