From 9c6e0a6e3a8a60dd1724e46928e4c18fb8d88c9b Mon Sep 17 00:00:00 2001 From: Claire Peters Date: Thu, 26 Oct 2023 13:01:34 -0700 Subject: [PATCH] update tasks to use send_email_template --- coldfront/core/allocation/tasks.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/coldfront/core/allocation/tasks.py b/coldfront/core/allocation/tasks.py index ac9face92..b83f49c2b 100644 --- a/coldfront/core/allocation/tasks.py +++ b/coldfront/core/allocation/tasks.py @@ -31,6 +31,7 @@ EMAIL_ADMINS_ON_ALLOCATION_EXPIRE = import_from_settings('EMAIL_ADMINS_ON_ALLOCATION_EXPIRE') EMAIL_ADMIN_LIST = import_from_settings('EMAIL_ADMIN_LIST') +ADMIN_REMINDER_EMAIL = import_from_settings('ADMIN_REMINDER_EMAIL') def update_statuses(): @@ -69,12 +70,14 @@ def send_request_reminder_emails(): 'signature': EMAIL_SIGNATURE, 'url_base': f'{CENTER_BASE_URL.strip("/")}/allocation/change-request/' } - send_admin_email_template( - 'Pending Allocation Changes', - 'email/pending_allocation_changes.txt', - allocation_change_template_context, - ) + send_email_template( + subject='Pending Allocation Changes', + template_name='email/pending_allocation_changes.txt', + template_context=allocation_change_template_context, + sender=EMAIL_SENDER, + receiver_list=[ADMIN_REMINDER_EMAIL,], + ) # Allocation Requests are allocations marked as "new" pending_allocations = Allocation.objects.filter( status__name = 'New', created__lte=req_alert_date @@ -87,11 +90,15 @@ def send_request_reminder_emails(): 'signature': EMAIL_SIGNATURE, 'url_base': f'{CENTER_BASE_URL.strip("/")}/allocation/' } - send_admin_email_template( - 'Pending Allocations', - 'email/pending_allocations.txt', - new_allocation_template_context, + + send_email_template( + subject='Pending Allocations', + template_name='email/pending_allocations.txt', + template_context=new_allocation_template_context, + sender=EMAIL_SENDER, + receiver_list=[ADMIN_REMINDER_EMAIL,], ) + # return statement for testing return (pending_changerequests, pending_allocations)