def send_email(self): """ This method should send email to just registered User with confirmation link """ key = get_secure_key(self.instance.email) site = Site.objects.get_current() UserConfirmation.objects.create(user=self.instance, key=key) context = {'site': site, 'key': key } kw_params = {'template_key': 'invitation_email', 'context': context, 'emails': [self.instance.email] } EmailTemplate.send(**kw_params)
def invite_notification(sender, instance, **kwargs): """ This function should notify invited person by email. """ context = {'hash_key': instance.hash_key, } params = {'template_key': 'invitation_email', 'context': context, 'emails': [instance.email, ]} return EmailTemplate.send(kw_params=params)