diff options
author | adityacp | 2016-05-05 17:14:20 +0530 |
---|---|---|
committer | adityacp | 2016-05-05 17:14:20 +0530 |
commit | e81b13f7d94c0877801726fc85e967f36ba8bd90 (patch) | |
tree | 28e8b0d3e39cf5d9a6ce77b42b712290f1a3baf3 /yaksh | |
parent | 01eee9b024b7717e264ed4b7a00873389fa07cd1 (diff) | |
download | online_test-e81b13f7d94c0877801726fc85e967f36ba8bd90.tar.gz online_test-e81b13f7d94c0877801726fc85e967f36ba8bd90.tar.bz2 online_test-e81b13f7d94c0877801726fc85e967f36ba8bd90.zip |
change dump json function
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 9 |
1 files 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): |