Added error messages and made the elements absolute positioned

This commit is contained in:
xemeds
2020-07-19 20:01:03 +00:00
parent cb286816fd
commit 1fa542b0cb
4 changed files with 55 additions and 30 deletions
+9 -16
View File
@@ -1,4 +1,4 @@
from flask import render_template, redirect, request, flash, url_for
from flask import render_template, redirect, request, url_for
from tiny0 import app
from tiny0.forms import URLForm
#from tiny0.models import URLs
@@ -7,21 +7,14 @@ from tiny0.forms import URLForm
# Index Page
@app.route("/", methods=['GET', 'POST'])
def index():
# Get request
if request.method == "GET":
# Create a instance of the form
form = URLForm()
# Create a instance of the form
form = URLForm()
# If the form was valid
if form.validate_on_submit():
return "Valid URL: " + form.url.data
# If the form was invalid or not submitted
else:
# Return the index page with the form
return render_template("index.html", form=form)
# Post request
else:
# Create a instance of the form
form = URLForm()
# If the form was valid
if form.validate_on_submit():
return "Valid URL: " + form.url.data
return render_template("index.html", form=form)