from django.dispatch import Signal from . import emails registration_created = Signal() def send_emails_on_registration(sender, **kwargs): # pylint: disable=unused-argument registration = kwargs.get('registration') # Inform the event owner (trainer) recipient = registration.event.owner email = emails.InformTrainerRegistrationMail(recipient=recipient, registration=registration) email.send() # Inform the potential participant recipient = '"{fullname}" <{email}>'.format(fullname=registration.get_full_name(), email=registration.email_address) email = emails.InformSelfRegistrationMail(recipient=recipient, registration=registration) email.send()