示例#1
0
    def save(self, *args, **kwargs):
        if not self.id:
            self.api_key = encryption.encryptData(self.api_key)
            self.app_secret = encryption.encryptData(self.app_secret)
            self.app_id = encryption.encryptData(self.app_id)
        else:
            if db_utils.isDirty(self, 'api_key'):
                self.api_key = encryption.encryptData(self.api_key)

            if db_utils.isDirty(self, 'app_secret'):
                self.app_secret = encryption.encryptData(self.app_secret)

            if db_utils.isDirty(self, 'app_id'):
                self.app_id = encryption.encryptData(self.app_id)

        super(SocialNetwork, self).save(*args, **kwargs)
示例#2
0
    def save(self, *args, **kwargs):
        if not self.id or db_utils.isDirty(self, 'access_token'):
            self.access_token = encryption.encryptData(self.access_token)

        super(UserNetworkCredentials, self).save(*args, **kwargs)