def api_update_user_hosts_by_id(id): user = users.get(id) user.hosts = [] for host in request.form.getlist("hosts[]"): user.hosts.append(hosts.get(int(host))) users.save(user) return jsonify(dict(rc=0))
def api_update_host_by_id(id): hosts.update(hosts.get(id), **request.form.to_dict()) return jsonify(dict(rc=0))
def api_get_host_by_id(id): return jsonify(dict(rc=0, data=hosts.get(id)))