def update_quora_status(self, qraccount, status_list): is_update = False for json_status in status_list: if not QrStatus.objects.filter(target=json_status['target'], action_type=json_status['action_type']): status = QrStatus() status.user_profile_name = json_status['user_name'] status.qrAccount = qraccount status.target = json_status['target'] status.url_target = json_status['url'] status.action_type = json_status['action_type'] status.user_profile_img = json_status['user_profile_image'] status.time_stamp = json_status['time_stamp'] status.save() is_update = True return is_update
def update_quora_status(self, qraccount, status_list): is_update = False for json_status in status_list: if not QrStatus.objects.filter(target=json_status["target"], action_type=json_status["action_type"]): status = QrStatus() status.user_profile_name = json_status["user_name"] status.qrAccount = qraccount status.target = json_status["target"] status.url_target = json_status["url"] status.action_type = json_status["action_type"] status.user_profile_img = json_status["user_profile_image"] status.time_stamp = json_status["time_stamp"] status.save() is_update = True return is_update
def save_status(act, status_list): for status in status_list: if not QrStatus.objects.filter(target=status.get('target', None)): new_status = QrStatus() new_status.qrAccount = act try: new_status.target = status['target'] new_status.url_profile_img = status['user_profile_image'] new_status.url_target = status['url'] new_status.action_type = status['action_type'] new_status.time_stamp = status['time_stamp'] new_status.user_profile_name = status['user_name'] except KeyError: continue new_status.save()