diff --git a/app.py b/app.py index 6000a18..7e2effa 100644 --- a/app.py +++ b/app.py @@ -1,14 +1,27 @@ -from flask import Flask, render_template +from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) -@app.route('/') +@app.route('/', methods=['GET','POST']) def home(): - return render_template('index.html') + if request.method == 'GET': + return render_template('index.html') + if request.method == 'POST': + return redirect(url_for('form')) + @app.route ('/form', methods=['GET','POST']) def form(): - return render_template('form.html') + if request.method == 'GET': + return render_template('form.html') + if request.method == 'POST': + user = request.form['name'] + return redirect(url_for('submitted')) + + +@app.route ('/submitted') +def submitted(): + return render_template('submitted.html') if __name__ == '__main__': diff --git a/templates/form.html b/templates/form.html index 9a61b76..512b349 100644 --- a/templates/form.html +++ b/templates/form.html @@ -5,6 +5,16 @@ {% endblock %} {% block content %} +
+ @@ -12,7 +22,7 @@ - +