This commit is contained in:
Alexandru 2024-09-17 21:31:47 +03:00
parent 998ff03f67
commit 4efb65ea44
2 changed files with 4 additions and 3 deletions

5
app.py
View File

@ -19,7 +19,7 @@ def index():
cs.execute(statement) cs.execute(statement)
return render_template("index.html", comments=cs.fetchall()) return render_template("index.html", comments=cs.fetchall())
@app.route('/submit', methods=["POST"]) @app.route('/gb/submit', methods=["POST"])
def submit(): def submit():
errors = [] errors = []
name = request.form.get("name") name = request.form.get("name")
@ -46,4 +46,5 @@ def submit():
values = (name, website, comment, int(time.time()), str(request.remote_addr)) values = (name, website, comment, int(time.time()), str(request.remote_addr))
cs.execute(statement, values) cs.execute(statement, values)
db.commit() db.commit()
return redirect("/") #change this if you run it on anything other than /gb
return redirect("/gb")

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" href="static/style.css"> <link rel="stylesheet" href="static/style.css">
</head> </head>
<body> <body>
<form method="POST" action="submit"> <form method="POST" action="/gb/submit">
<input name="name" placeholder="Name (optional)"> <input name="name" placeholder="Name (optional)">
<input name="website" placeholder="Website (optional, w/o the http(s) part)"> <input name="website" placeholder="Website (optional, w/o the http(s) part)">
<textarea name="comment" placeholder="Comment (max 512 characters)"></textarea> <textarea name="comment" placeholder="Comment (max 512 characters)"></textarea>