def get_prep_value(self, value): if value is not None and value != '': bc = BCipher() enc = bc.encrypt(value) else: enc = value return enc
def pre_save(self, model_instance, add): cleartext = getattr(model_instance, self.attname) key = getattr(settings, 'SECRET_KEY') bc = BCipher(key) enc = bc.encrypt(cleartext) setattr(model_instance, self.attname, enc) return enc
def _set_password(self, clear_text): bc = BCipher() setattr(self, 'password', bc.encrypt(clear_text))
def set_repo_pwd(self, clear_text): bc = BCipher() setattr(self, 'repo_pwd', bc.encrypt(clear_text))