# At the top
from distutils.util import strtobool
@app.route("/", methods=["GET", "POST"])
def home():
if request.form:
try:
form_status = strtobool(request.form.get("status").lower())
status = Projects(status=form_status)
db.session.add(status)
db.session.commit()
except ValueError:
# Handle the error - e.g. flash a message to the user
flash("Invalid input")
return render_template("home.html")