def new_question_comment(question_id=None): if request.method == "GET": question = persistence.get_item_by_id("question", question_id) return render_template('add_comment.html', question=question, question_id=question_id) if request.method == "POST": dict = logic.comment_dict(request.form["comment"], question_id=question_id) persistence.add_row_to_db(dict, "comment") return redirect('/question/' + str(question_id))
def new_question_comment(question_id=None): if request.method == "GET": user_list = logic.show_the_users() question = persistence.get_item_by_id("question", question_id) return render_template('add_comment.html', question=question, question_id=question_id, user_list=user_list) if request.method == "POST": user_id = persistence.get_user_id(request.form["username"])[0]['id'] dict = logic.comment_dict(request.form["comment"], question_id=question_id) persistence.add_row_to_db(dict, "comment", user_id) return redirect('/question/' + str(question_id))
def submit_question(): dict = logic.question_dict(request.form["title"], request.form["question"]) persistence.add_row_to_db(dict, "question") return redirect('/list')
def submit_answer(question_id): dict = logic.answer_dict(question_id, request.form['answer']) persistence.add_row_to_db(dict, "answer") return redirect('/question/' + str(question_id))
def submit_question(): user_id = persistence.get_user_id(request.form["username"])[0]['id'] dict = logic.question_dict(request.form["title"], request.form["question"]) persistence.add_row_to_db(dict, "question", user_id) return redirect('/list')
def submit_answer(question_id=None): user_id = persistence.get_user_id(request.form["user"])[0]['id'] dict = logic.answer_dict(question_id, request.form['answer']) persistence.add_row_to_db(dict, "answer", user_id) return redirect('/question/' + str(question_id))