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 %} +
+
+

Name:

+

+

Email:

+

+
+

+
+ @@ -12,7 +22,7 @@ - +

{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index e33e434..8344c3b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,5 +5,14 @@ {% endblock %} {% block content %} - Content: Index -{% endblock %} \ No newline at end of file +

+ Um die Frage vorab zu beantworten: "WTF... hasch du di wirklich in Web-programmierung inkl. CSS und Javascript eingelesen
, gelernt des ganze Backend mit Python zu schreiben und des ganze auf deinem eigenen Server deployed... nur für den Joke?!" +

+

JA

+
+
+

Hier geht es zum Antragformular:

+
+

+
+ {% endblock %} \ No newline at end of file diff --git a/templates/submitted.html b/templates/submitted.html new file mode 100644 index 0000000..e32c9b2 --- /dev/null +++ b/templates/submitted.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %} + Title: Submitted +{% endblock %} + +{% block content %} + Formular eingereicht! + {% endblock %} \ No newline at end of file