Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Send confirmation email after successful submission of proposal #1331

Open
wants to merge 9 commits into
base: ep2021
Choose a base branch
from
29 changes: 26 additions & 3 deletions conference/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.urls import reverse_lazy
from django.db import transaction
Expand Down Expand Up @@ -120,9 +121,31 @@ def submit_proposal_step3_thanks(request, talk_uuid):
Step3 - thanks for proposal
"""
talk = get_object_or_404(Talk, uuid=talk_uuid)
return TemplateResponse(request, "conference/cfp/step3_thanks.html", {
"talk": talk,
})
speakers = list(talk.get_all_speakers())
speaker_emails = [speaker.user.email for speaker in speakers]
speaker_names = ",".join(
[f"{speaker.user.first_name} {speaker.user.last_name}" for speaker in speakers]
)
current_site = get_current_site(request)
cfp_path = reverse_lazy("cfp:preview", args=[talk.slug])
proposal_url = f"https://{current_site}{cfp_path}"
content = f"""
Sangarshanan marked this conversation as resolved.
Show resolved Hide resolved
Hi {speaker_names}!
We have received your submission "{talk.title}".
We will notify you once we have had time to consider all submissions,
but until then you can see and edit your submission at {proposal_url}

Please do not hesitate to contact us at at helpdesk@europython.eu if you have any questions!
Sangarshanan marked this conversation as resolved.
Show resolved Hide resolved
"""
send_mail(
subject=f"Your submission to {settings.CONFERENCE_NAME}: {talk.title}",
message=content,
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=speaker_emails,
)
Sangarshanan marked this conversation as resolved.
Show resolved Hide resolved
return TemplateResponse(
request, "conference/cfp/step3_thanks.html", {"talk": talk,}
)


@login_required
Expand Down