summaryrefslogtreecommitdiff
path: root/routes/create.py
diff options
context:
space:
mode:
authorAira Kyytsönen <akyytson@local>2023-12-12 01:59:51 +0200
committerAira Kyytsönen <akyytson@local>2023-12-12 01:59:51 +0200
commit84d1277c408038ab0df6179659c68ac7f08a098f (patch)
tree8a6f374e9810198a8559d8a236f8179c909c1fe7 /routes/create.py
parent3dc9e71b7c733e7fe6fe9e226ad363f84a2e1dee (diff)
Changing database variable D to db. Making error and infomessages dissapear.
Diffstat (limited to 'routes/create.py')
-rw-r--r--routes/create.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/routes/create.py b/routes/create.py
index d2701a2..f584543 100644
--- a/routes/create.py
+++ b/routes/create.py
@@ -1,4 +1,4 @@
-from app import app, D
+from app import app, db
from flask import render_template,session,request,redirect
from routes.tools import rows2dicts, get_alert, get_nick, generate_link, csrf_check
@@ -18,7 +18,7 @@ def create():
alert=get_alert(),
nick=get_nick()
)
- if D.quiz.get_link(session["quiz_id"]):
+ if db.quiz.get_link(session["quiz_id"]):
return render_template(
"create.html",
caller="create",
@@ -33,7 +33,7 @@ def create():
nick=get_nick(),
quiz_set=True,
questions=rows2dicts(
- D.quiz.questions(session["quiz_id"]),
+ db.quiz.questions(session["quiz_id"]),
['i','q','n','p','a']
)
)
@@ -46,7 +46,7 @@ def new_quiz():
session["alert"]="Tarvitset nimimerkin loudaksesi."
return redirect("/#create")
user_id = session["id"]
- session["quiz_id"] = D.quiz.new( user_id )
+ session["quiz_id"] = db.quiz.new( user_id )
return redirect("/#create")
@@ -57,10 +57,10 @@ def quiz_ready():
if "quiz_id" not in session.keys():
session["alert"] = "Kyselmä jota ei ole aloitettu ei voi olla valmis."
return redirect("/#create")
- if not D.quiz.user(session["quiz_id"], session["id"]):
+ if not db.quiz.user(session["quiz_id"], session["id"]):
session["alert"] = "Tyhjän kyselmän luominen ei käy päinsä!"
return redirect("/#create")
quiz_id = session["quiz_id"]
session["answer_id"] = session["quiz_id"]
- D.quiz.set_link(session["quiz_id"], generate_link())
+ db.quiz.set_link(session["quiz_id"], generate_link())
return redirect("/#analyse")