def func(self, args, request): if not args: raise MudderyError(ERR.missing_args, 'Missing arguments.') if 'action' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "action".') if 'event' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "event".') if 'values' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "values".') action_type = args["action"] event_key = args["event"] values = args["values"] # Get action's data. action = EVENT_ACTION_SET.get(action_type) if not action: raise MudderyError(ERR.no_table, "Can not find action: %s" % action_type) table_name = action.model_name # Remove old records. data_edit.delete_records(table_name, event_key=event_key) # Add new data. for value in values: data_edit.save_form(value, table_name) return success_response("success")
def func(self, args, request): if not args: raise MudderyError(ERR.missing_args, 'Missing arguments.') if 'action' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "action".') if 'event' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "event".') if 'values' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "values".') action_type = args["action"] event_key = args["event"] values = args["values"] # Get action's data. action = EVENT_ACTION_SET.get(action_type) if not action: raise MudderyError(ERR.no_table, "Can not find action: %s" % action_type) table_name = action.model_name # Remove old records. data_edit.delete_records(table_name, event_key=event_key) # Add new data. for value in values: data_edit.save_form(value, table_name) return success_response("success")
def func(self, args, request): if not args: raise MudderyError(ERR.missing_args, 'Missing arguments.') if 'values' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "values".') if 'table' not in args: raise MudderyError(ERR.missing_args, 'Missing the argument: "table".') values = args["values"] table_name = args["table"] record_id = args.get('record', None) record_id = data_edit.save_form(values, table_name, record_id) data = data_edit.query_form(table_name, id=record_id) return success_response(data)
def func(self, args, request): if not args: raise MudderyError(ERR.missing_args, 'Missing arguments.') if 'values' not in args: raise MudderyError(ERR.missing_args, 'Missing argument: "values".') if 'table' not in args: raise MudderyError(ERR.missing_args, 'Missing argument: "table".') values = args["values"] table_name = args["table"] record_id = args.get('record', None) record_id = data_edit.save_form(values, table_name, record_id) data = general_query.query_record(table_name, record_id) return success_response(data)