Skip to content
This repository was 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
Open
Show file tree
Hide file tree
Changes from 5 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
30 changes: 27 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,32 @@ 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"""
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 [email protected] if you have any questions!
"""
send_mail(
subject=f"Your submission to {settings.CONFERENCE_NAME}: {talk.title}",
message=content,
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=speaker_emails,
bcc=settings.CFP_SUBMISSION_BCC_ADDRESS
)
return TemplateResponse(
request, "conference/cfp/step3_thanks.html", {"talk": talk,}
)


@login_required
Expand Down
3 changes: 3 additions & 0 deletions pycon/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def _(x):
# Email sender address used per default for emails to e.g. attendees
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='[email protected]')

# BCC these emails on cfp submissions
CFP_SUBMISSION_BCC_ADDRESS = config('CFP_SUBMISSION_BCC_ADDRESS', default=['[email protected]'])

# Timezone and languages
# -----------------------
# If you set this to False, Django will make some optimizations so as not
Expand Down