def netops_main_static_view(req, sr_id=None, host_id=None): if req.method == 'POST': if 'sr_id' in req.data: sr_id = req.data.pop('sr_id') Host.set(**req.data) elif req.method == 'DELETE': Host.clear(host_id) return DIV().html( netops.table( TABLE.SYNC('Name', 'IP', 'MAC', 'Model', 'Serial', 'Description', 'Action'), 'netops_main_static_table', sr_id), netops.refresh('netops_main_status_view'), netops.refresh('netops_main_total_view'))
def api_setHost(req): host = Host.set(**req.data) if host: return { 'id': host.id, 'name': host.name, 'mac': host.mac, 'ip': host.ip, 'model': host.model, 'serial': host.serial, 'range_name': host.range_name, 'desc': host.desc } return None