Ejemplo n.º 1
0
def edit_node(node):
    g = Graph()
    if request.method == 'POST':
        _edit_node(g, node)
    return render_template(
        'main/edit.html',
        graph=g,
        nodes=g.nodes,
        node=node,
        paths=g.get_paths_from(node)
    )
Ejemplo n.º 2
0
def add_node():
    g = Graph()
    node = ""
    error = ""
    if request.method == "POST":
        new_node = request.form.get("current_node")
        nodes = request.form.getlist("node")
        weights = request.form.getlist("weight")
        if _add_node(g):
            return redirect(url_for("main.index"))
        error = "Can't create node {}. It already exists.".format(new_node)
    return render_template(
        "main/edit.html", graph=g, nodes=g.nodes, node=node, paths=g.get_paths_from(node), error=error
    )
Ejemplo n.º 3
0
def add_node():
    g = Graph()
    node = ''
    error = ''
    if request.method == 'POST':
        new_node = request.form.get('current_node')
        nodes = request.form.getlist('node')
        weights = request.form.getlist('weight')
        if _add_node(g):
            return redirect(url_for('main.index'))
        error = "Can't create node {}. It already exists.".format(new_node)
    return render_template(
        'main/edit.html',
        graph=g,
        nodes=g.nodes,
        node=node,
        paths=g.get_paths_from(node),
        error=error
    )
Ejemplo n.º 4
0
def edit_node(node):
    g = Graph()
    if request.method == "POST":
        _edit_node(g, node)
    return render_template("main/edit.html", graph=g, nodes=g.nodes, node=node, paths=g.get_paths_from(node))