Coverage for website/events/tasks.py: 38.46%
11 statements
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
1from celery import shared_task
3from events.emails import notify_registration
4from events.models import EventRegistration
7@shared_task
8def send_registration_confirmation_email(registration_id: int):
9 try:
10 registration = EventRegistration.objects.get(pk=registration_id)
11 except EventRegistration.DoesNotExist:
12 return # The registration was deleted.
13 if (
14 # Repeat the checks from the calling signal just in case
15 # something changed between calling and running this task.
16 registration.is_registered
17 and registration.email
18 and registration.event.registration_required
19 and (
20 registration.member is None
21 or registration.member.profile.receive_registration_confirmation
22 )
23 ):
24 notify_registration(registration)