Skip to content

Commit 9c6e0a6

Browse files
committed
update tasks to use send_email_template
1 parent 49691d8 commit 9c6e0a6

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

coldfront/core/allocation/tasks.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
EMAIL_ADMINS_ON_ALLOCATION_EXPIRE = import_from_settings('EMAIL_ADMINS_ON_ALLOCATION_EXPIRE')
3333
EMAIL_ADMIN_LIST = import_from_settings('EMAIL_ADMIN_LIST')
34+
ADMIN_REMINDER_EMAIL = import_from_settings('ADMIN_REMINDER_EMAIL')
3435

3536
def update_statuses():
3637

@@ -69,12 +70,14 @@ def send_request_reminder_emails():
6970
'signature': EMAIL_SIGNATURE,
7071
'url_base': f'{CENTER_BASE_URL.strip("/")}/allocation/change-request/'
7172
}
72-
send_admin_email_template(
73-
'Pending Allocation Changes',
74-
'email/pending_allocation_changes.txt',
75-
allocation_change_template_context,
76-
)
7773

74+
send_email_template(
75+
subject='Pending Allocation Changes',
76+
template_name='email/pending_allocation_changes.txt',
77+
template_context=allocation_change_template_context,
78+
sender=EMAIL_SENDER,
79+
receiver_list=[ADMIN_REMINDER_EMAIL,],
80+
)
7881
# Allocation Requests are allocations marked as "new"
7982
pending_allocations = Allocation.objects.filter(
8083
status__name = 'New', created__lte=req_alert_date
@@ -87,11 +90,15 @@ def send_request_reminder_emails():
8790
'signature': EMAIL_SIGNATURE,
8891
'url_base': f'{CENTER_BASE_URL.strip("/")}/allocation/'
8992
}
90-
send_admin_email_template(
91-
'Pending Allocations',
92-
'email/pending_allocations.txt',
93-
new_allocation_template_context,
93+
94+
send_email_template(
95+
subject='Pending Allocations',
96+
template_name='email/pending_allocations.txt',
97+
template_context=new_allocation_template_context,
98+
sender=EMAIL_SENDER,
99+
receiver_list=[ADMIN_REMINDER_EMAIL,],
94100
)
101+
95102
# return statement for testing
96103
return (pending_changerequests, pending_allocations)
97104

0 commit comments

Comments
 (0)