def POST(self): i = web.input() firstname = i.firstname lastname = i.lastname student_id = model.get_student(firstname, lastname)['id'] session.student_id = student_id web.seeother('/dashboard')
def POST(self): i = web.input() attempt_id = i.attempt_id question_id = i.question_id answers = i.answers.strip(',').split(',') model.update_answers(web.ctx.session['student_id'], attempt_id, question_id, answers) pass
def GET(self): i = web.input() test_id = i.test_id student_id = web.ctx.session['student_id'] attempt_id = model.start_new_attempt(test_id, student_id) raise web.seeother('/test?attempt_id=%s&test_id=%s' % (attempt_id, test_id))
def POST(self): data = web.input() data.username = session_data['user']['username'] post_model = Posts.Posts() post_model.insert_post(data) return "success"
def GET(self): i = web.input() attempt_id = i.attempt_id test_id = i.test_id student_id = web.ctx.session['student_id'] questions = model.get_questions_for_test(test_id, student_id, attempt_id) return render.test('Test', attempt_id, questions)
def POST(self): data = web.input() data.username = session_data["user"]["username"] settings_model = LoginModel.LoginModel() if settings_model.update_info(data): return "success" else: return "An error occurred"
def POST(self): i = web.input() password = i.password if password == "HardTaught": web.ctx.session["admin_logged_in"] = True raise web.seeother("/") else: return render.admin()
def GET(self): i = web.input() topic_id = i.topic_id if i.get("json"): questions = model.get_questions_for_topic(topic_id) return json.dumps(questions) else: topic_name = model.get_topic(topic_id)["name"] return render.questions(topic_id, topic_name)
def POST(self): data = web.input() login = LoginModel.LoginModel() isCorrect = login.check_user(data) if isCorrect: session_data["user"] = isCorrect return isCorrect return "error"
def GET(self): i = web.input() question_id = i["question_id"] print "question id is", question_id question = model.get_question(question_id) print "Question is", question topic_id = question["topic_id"] action = i.action if action == "delete": model.delete_question(question_id) raise web.seeother("questions?topic_id=%(id)s" % {"id": topic_id})
def POST(self): i = web.input() action = i.action if action == "add": name = i.name model.add_topic(name) elif action == "delete": id = i.id model.delete_topic(id) elif action == "rename": id = i.id name = i.name print id, name model.rename_topic(id, name)
def POST(self): i = web.input(topics=[], final=False) action = i.action if action == "add": topic_ids = [int(x) for x in i.topics] question_count = int(i.question_count) name = i.name final = i.final model.add_test(name, topic_ids, question_count, final) elif action == "rename": name = i.name model.rename_test(test_id, name) elif action == "delete": test_id = i.id model.delete_test(test_id)
def POST(self): data = web.input() reg_model = RegisterModel.RegisterModel() reg_model.add_user(data) return data.username
def GET(self): i = web.input() test_id = i.test_id student_id = web.ctx.session['student_id'] attempt_id = model.start_new_attempt(test_id, student_id) raise web.seeother('/test?attempt_id=%s&test_id=%s'%(attempt_id, test_id))
def POST(self): i = web.input() questions = i["file"] topic_id = i["topic_id"] model.upload_questions(topic_id, questions) raise web.seeother("/questions?topic_id=%(id)s" % {"id": topic_id})
def POST(self): i = web.input() attempt_id = i.attempt_id if i.finished == '1': model.save_attempt(attempt_id) raise web.seeother('../dashboard')
def GET(self): i = web.input() attempt_id = i.attempt_id test_id = i.test_id raise web.seeother('/test?attempt_id=%s&test_id=%s' % (attempt_id, test_id))
def GET(self): i = web.input() attempt_id = i.attempt_id test_id = i.test_id raise web.seeother('/test?attempt_id=%s&test_id=%s'%(attempt_id, test_id))