Exemple #1
0
    def save(self):
        data = self.cleaned_data
        person = Person(
            first_name=data['first_name'],
            last_name=data['last_name'],
            username=data['username'],
            email=data['email']
        )

        person.set_password(data['password'])
        person.save()

        # Send confirmation email
        TemplateEmail(
            subject='Registration',
            from_email='*****@*****.**',
            to_emails=person.email,
            template='email/confirmation_email.html',
            context={
                'user': person,
                'activation_link': absreverse('person:confirmation', kwargs={'key': person.confirmation})
            }
        ).send()

        return person