2019-08-08 09:03:46 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
|
|
|
from .models import OutgoingEmail
|
|
|
|
|
|
|
|
|
2019-08-08 09:09:25 +00:00
|
|
|
@admin.register(OutgoingEmail)
|
2019-08-08 09:03:46 +00:00
|
|
|
class OutgoingEmailAdmin(admin.ModelAdmin):
|
|
|
|
model = OutgoingEmail
|
2020-06-22 15:25:08 +00:00
|
|
|
list_display = ["subject", "to_recipients", "processed", "hold", "responsible_team"]
|
2020-07-29 18:40:04 +00:00
|
|
|
list_filter = ["processed", "hold", "responsible_team"]
|
2020-07-29 19:07:50 +00:00
|
|
|
actions = ["hold_emails", "release_emails"]
|
|
|
|
|
|
|
|
def hold_emails(self, request, queryset):
|
|
|
|
for email in queryset.filter(hold=False, processed=False):
|
|
|
|
email.hold = True
|
|
|
|
email.save()
|
|
|
|
|
|
|
|
hold_emails.description = "Mark these emails with hold=True"
|
|
|
|
|
|
|
|
def release_emails(self, request, queryset):
|
|
|
|
for email in queryset.filter(hold=True, processed=False):
|
|
|
|
email.hold = False
|
|
|
|
email.save()
|
|
|
|
|
|
|
|
release_emails.description = "Mark these emails with hold=False"
|