feature_extractor/visualizer/visualizer.py
def create():
        """Create a new post for the current user."""
        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(
                    "INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)",
                    (title, body, g.user["id"]),
                )
                db.commit()
                return redirect(url_for("visualizer.index"))

        return render_template("visualizer/create.html")
Create a new post for the current user.
Create a new post for the current user.
Create a new post for the current user .
def create():
        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(
                    "INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)",
                    (title, body, g.user["id"]),
                )
                db.commit()
                return redirect(url_for("visualizer.index"))
        return render_template("visualizer/create.html")
def create ( ) : 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 ( "INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)" , ( title , body , g . user [ "id" ] ) , ) db . commit ( ) return redirect ( url_for ( "visualizer.index" ) ) return render_template ( "visualizer/create.html" )
Create a new post for the current user.
Create a new post for the current user .
"""Create a new post for the current user."""