Coverage for events/services.py: 27%
11 statements
« prev ^ index » next coverage.py v6.4.4, created at 2022-10-10 18:02 -0500
« prev ^ index » next coverage.py v6.4.4, created at 2022-10-10 18:02 -0500
1from django.conf import settings
2from app.sendgrid import SendgridClient
5def send_rsvp_email(participant):
7 url = f"{settings.FRONTEND_DOMAIN}/rsvp/{participant.random_slug}"
8 accept_url = f"{url}?r=A"
9 reject_url = f"{url}?r=R"
11 try:
12 sendgrid = SendgridClient(
13 to=participant.user.email,
14 )
15 sendgrid.send_dynamic_email(
16 template_id=settings.SENDGRID_RSVP_TEMPLATE,
17 dynamic_template_data={
18 "name": participant.user.name,
19 "event": participant.event.name,
20 "accept_url": accept_url,
21 "reject_url": reject_url,
22 }
23 )
24 except Exception as e:
25 print(e)