summaryrefslogtreecommitdiff
path: root/routes.py
diff options
context:
space:
mode:
Diffstat (limited to 'routes.py')
-rw-r--r--routes.py41
1 files changed, 35 insertions, 6 deletions
diff --git a/routes.py b/routes.py
index b38cf3c..7e7f2ca 100644
--- a/routes.py
+++ b/routes.py
@@ -1,5 +1,6 @@
from app import app
from flask import render_template,session
+import db_actions as D
def get_alert():
if "alert" in session:
@@ -7,6 +8,11 @@ def get_alert():
del session["alert"]
return f"{alert}"
return ""
+
+def get_nick():
+ if "id" in session.keys():
+ return D.user_get_nick(session["id"])
+ return "(ei nimimerkkiä)"
@app.route("/")
def index():
@@ -14,30 +20,53 @@ def index():
@app.route("/pages/info.html")
def info():
- return render_template("info.html", alert=get_alert() )
+ return render_template("info.html",
+ alert=get_alert()
+ )
@app.route("/pages/create.html")
def create():
- if "id" not in session:
+ if "id" not in session.keys():
return "redirect = #nick"
- return render_template("create.html", alert=get_alert() )
+ if "quiz_id" not in session.keys():
+ return "redirect = #quiz"
+ return render_template("create.html",
+ alert=get_alert(),
+ nick=get_nick()
+ )
@app.route("/pages/answer.html")
def answer():
if "id" not in session:
return "redirect = #nick"
- return render_template("answer.html", alert=get_alert() )
+ return render_template("answer.html",
+ alert=get_alert(),
+ nick=get_nick()
+ )
@app.route("/pages/analyse.html")
def analyse():
if "id" not in session:
return "redirect = #nick"
- return render_template("analyse.html", alert=get_alert() )
+ return render_template("analyse.html",
+ alert=get_alert(),
+ nick=get_nick()
+ )
@app.route("/pages/moderate.html")
def moderate():
- return render_template("moderate.html", alert=get_alert() )
+ return render_template("moderate.html",
+ alert=get_alert()
+ )
@app.route("/pages/nick.html")
def nick():
return render_template("nick.html", alert=get_alert() )
+
+@app.route("/pages/question.html")
+def question():
+ return render_template("question.html", alert=get_alert() )
+
+@app.route("/pages/quiz.html")
+def build():
+ return render_template("quiz.html", alert=get_alert() )