def generate_token(self): self.verification_code = generate_random_string(24).upper() self.save()
def save(self, *args, **kwargs): if not self.verification_code: self.verification_code = generate_random_string(24).upper() super(PasswordResetCode, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if not self.verification_code: self.verification_code = generate_random_string(8).upper() super(EmailVerificationCode, self).save(*args, **kwargs)