feature_extractor/visualizer/visualizer copy.py
def update(id):
    """Update a post if the current user is the author."""
    post = get_post(id)

    if request.method == "POST":
        title = request.form["title"]
        body = request.form["body"]
        error = None

        if not title:
            error = "Title is required."

        if error is not None:
            flash(error)
        else:
            db = get_db()
            db.execute(
                "UPDATE post SET title = ?, body = ? WHERE id = ?", (title, body, id)
            )
            db.commit()
            return redirect(url_for("visualizer.index"))

    return render_template("visualizer/update.html", post=post)
Update a post if the current user is the author.
Update a post if the current user is the author.
Update a post if the current user is the author .
def update(id):
    post = get_post(id)
    if request.method == "POST":
        title = request.form["title"]
        body = request.form["body"]
        error = None
        if not title:
            error = "Title is required."
        if error is not None:
            flash(error)
        else:
            db = get_db()
            db.execute(
                "UPDATE post SET title = ?, body = ? WHERE id = ?", (title, body, id)
            )
            db.commit()
            return redirect(url_for("visualizer.index"))
    return render_template("visualizer/update.html", post=post)
def update ( id ) : post = get_post ( id ) if request . method == "POST" : title = request . form [ "title" ] body = request . form [ "body" ] error = None if not title : error = "Title is required." if error is not None : flash ( error ) else : db = get_db ( ) db . execute ( "UPDATE post SET title = ?, body = ? WHERE id = ?" , ( title , body , id ) ) db . commit ( ) return redirect ( url_for ( "visualizer.index" ) ) return render_template ( "visualizer/update.html" , post = post )
Update a post if the current user is the author.
Update a post if the current user is the author .
"""Update a post if the current user is the author."""
id