-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
63 lines (51 loc) · 2.03 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from flask import Flask, render_template, request, redirect, url_for
from forms import MyForm
from trivia_class import Questions
app = Flask(__name__)
app.config["SECRET_KEY"] = "TommyShelby"
@app.route("/", methods=["GET", "POST"])
def home_page():
form = MyForm()
if request.method == "POST":
if form.validate_on_submit():
if form.decision.data == "TRYB VOLDEMORT":
return redirect(
url_for("first_quiz_page")
)
# if form.quiz_type.data == "Multiple Choice":
# return redirect(url_for("first_quiz_page",
# quantity=form.quantity.data,
# category=form.category.data
# )
# )
# else:
# return redirect(url_for("second_quiz_page",
# quantity=form.quantity.data,
# category=form.category.data
# )
# )
return render_template("index.html", form=form)
@app.route("/quiz/multiple-choice")
def first_quiz_page():
tool = Questions()
data_1 = tool.get_questions()
return render_template("quiz_first.html", data=data_1, name="Zadanie 1")
@app.route("/quiz/snake")
def second_quiz_page():
# tool = Questions()
# data_2 = tool.get_questions()
return render_template("snake.html", name="Zadanie 2")
# tool = Questions()
# my_data = tool.get_questions(
# amount=5,
# category="Animals",
# quiz_type="boolean"
# )
# return render_template("quiz_second.html", data=my_data, name="Zadanie 2")
@app.route("/quiz/riddle")
def third_quiz_page():
# tool = Questions()
# data_2 = tool.get_questions()
return render_template("riddle.html", name="Zadanie 3")
if __name__ == "__main__":
app.run(debug=True)