diff --git a/utilities/page/question_view/question_view.js b/utilities/page/question_view/question_view.js index 3d16fa86bd..4b63c99e9e 100644 --- a/utilities/page/question_view/question_view.js +++ b/utilities/page/question_view/question_view.js @@ -94,7 +94,8 @@ KBQuestionView = function(w, qid, qtext) { var v = $(me.input).val(); if(!v) { msgprint('Write something!'); return; } me.btn.set_working(); - $c_page('utilities', 'question_view', 'add_answer', {qid: qid, answer:v}, + $c_page('utilities', 'question_view', 'add_answer', + JSON.stringify({qid: qid, "answer":v}), function(r, rt) { me.btn.done_working(); me.ans_list.list.run(); diff --git a/utilities/page/question_view/question_view.py b/utilities/page/question_view/question_view.py index 78293854a6..e79a808f13 100644 --- a/utilities/page/question_view/question_view.py +++ b/utilities/page/question_view/question_view.py @@ -34,15 +34,14 @@ def get_question(arg): return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0]) @webnotes.whitelist() -def add_answer(args): - args = load_json(args) +def add_answer(arg): + arg = load_json(arg) from webnotes.model.doc import Document - a = Document('Answer') - a.answer = args['answer'] - a.question = args['qid'] + a.answer = arg['answer'] + a.question = arg['qid'] a.points = 1 a.save(1) - webnotes.conn.set_value('Question', args['qid'], 'modified', now()) \ No newline at end of file + webnotes.conn.set_value('Question', arg['qid'], 'modified', now()) \ No newline at end of file