From e81b13f7d94c0877801726fc85e967f36ba8bd90 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 5 May 2016 17:14:20 +0530 Subject: change dump json function --- yaksh/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/yaksh/models.py b/yaksh/models.py index aa08278..6e59d7a 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -213,13 +213,16 @@ class Question(models.Model): def dump_into_json(self, question_ids, user): questions = Question.objects.filter(id__in = question_ids, user_id = user.id) - questions_dict = [{'summary': question.summary, - 'description': question.description, + questions_dict = [] + for question in questions: + q_dict = {'summary': question.summary, 'description': question.description, 'points': question.points, 'test': question.test, 'ref_code_path': question.ref_code_path, 'options': question.options, 'language': question.language, 'type': question.type, 'active': question.active, - 'snippet': question.snippet} for question in questions] + 'snippet': question.snippet} + questions_dict.append(q_dict) + return json.dumps(questions_dict, indent=2) def load_from_json(self, questions_list, user): -- cgit