Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tasks to use send_email_template #263

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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