diff --git a/src/utils/admin.py b/src/utils/admin.py index 6b710965..0d8bc8fb 100644 --- a/src/utils/admin.py +++ b/src/utils/admin.py @@ -8,3 +8,18 @@ class OutgoingEmailAdmin(admin.ModelAdmin): model = OutgoingEmail list_display = ["subject", "to_recipients", "processed", "hold", "responsible_team"] list_filter = ["processed", "hold", "responsible_team"] + 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"