def regen_key(self): self.key = generate_apikey()
def save(self, *args, **kwargs): if not self.id: self.key = generate_apikey() super(Recover, self).save(*args, **kwargs)