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 update_answers(): if not (loggedin() and all(key in request.form for key in ["question_id", "attempt_id", "answers"])): return "" student_id = session["student_id"] question_id = request.form["question_id"] attempt_id = request.form["attempt_id"] answers = request.form["answers"] answers = answers.strip(",").split(",") model.update_answers(student_id, attempt_id, question_id, answers) if request.method == "GET": return redirect(url_for("dashboard")) return ""
def update_answers(): if not (loggedin() \ and all(key in request.form for key in \ ['question_id',\ 'attempt_id',\ 'answers'])): return '' student_id = session['student_id'] question_id = request.form['question_id'] attempt_id = request.form['attempt_id'] answers = request.form['answers'] answers = answers.strip(',').split(',') model.update_answers(student_id, attempt_id, question_id, answers) if request.method == 'GET': return redirect(url_for('dashboard')) return ''