Skip to content

Commit

Permalink
Merge pull request #263 from fasrc/cp_allocationrequest_email_reminders
Browse files Browse the repository at this point in the history
update tasks to use send_email_template
  • Loading branch information
claire-peters authored Oct 30, 2023
2 parents d133693 + 9c6e0a6 commit 567bd89
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions coldfront/core/allocation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():

Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 567bd89

Please sign in to comment.