add admin actions to hold and release emails
This commit is contained in:
parent
e011e5d048
commit
57dc6f12d8
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue