Exemplo n.º 1
0
    def save(self):

        instance = super(SurveyForm, self).save(commit=False)

        # Generate random salt
        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]

        # Generate activation key
        instance.activation_key = hashlib.sha1(salt + instance.email).hexdigest()

        # Set active to False
        instance.active = False

        # Save changes
        instance.save()
        self.save_m2m()
        instance.save_hidden()

        # Send activation email
        activation.send_activation_email(instance)
Exemplo n.º 2
0
    def send_reminders(self):

        for survey in self.filter(is_active=False).exclude(activation_key='ACTIVATED'):
            activation.send_activation_email(survey)