Added URL validation form

This commit is contained in:
xemeds
2020-07-18 16:40:51 +00:00
parent c783e7792a
commit d97b3266c8
5 changed files with 68 additions and 8 deletions
+21 -3
View File
@@ -1,9 +1,27 @@
from flask import render_template, redirect, request, flash, url_for
from tiny0 import app
#from tiny0.forms import URLForm
from tiny0.forms import URLForm
#from tiny0.models import URLs
#from token import gen_valid_token
@app.route("/")
# Index Page
@app.route("/", methods=['GET', 'POST'])
def index():
return "Hello, world!"
# Get request
if request.method == "GET":
# Create a instance of the form
form = URLForm()
# 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"
return render_template("index.html", form=form)