{"action":"created","comment":{"url":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments/76221075","id":76221075,"diff_hunk":"@@ -231,27 +235,32 @@ def consolidate_answer_data(self, user_answer):\n     def dump_into_json(self, question_ids, user):\n         questions = Question.objects.filter(id__in=question_ids, user_id=user.id)\n         questions_dict = []\n+        zip_file_name = StringIO()\n+        zip_file = zipfile.ZipFile(zip_file_name, \"a\")\n         for question in questions:\n             test_case = question.get_test_cases()\n+            files = question._add_and_get_files(zip_file)\n             q_dict = {'summary': question.summary,\n                       'description': question.description,\n-                      'points': question.points,\n-                      'language': question.language,\n-                      'type': question.type,\n-                      'active': question.active,\n+                      'points': question.points, 'language': question.language,\n+                      'type': question.type, 'active': question.active,\n                       'test_case_type': question.test_case_type,\n                       'snippet': question.snippet,\n-                      'testcase': [case.get_field_value() for case in test_case]}\n+                      'testcase': [case.get_field_value() for case in test_case],\n+                      'files': files}\n             questions_dict.append(q_dict)\n-\n-        return json.dumps(questions_dict, indent=2)\n+        question._add_json_to_zip(zip_file, questions_dict)\n+        return zip_file_name\n \n     def load_from_json(self, questions_list, user):\n         questions = json.loads(questions_list)\n+        ques = Question()\n         for question in questions:\n             question['user'] = user\n+            files = question.pop('files')\n             test_cases = question.pop('testcase')\n             que, result = Question.objects.get_or_create(**question)\n+            que._add_files_to_db(files)","path":"yaksh/models.py","position":50,"original_position":50,"commit_id":"c231dcb006c7dc6db4dc0312f53447971776635f","original_commit_id":"c231dcb006c7dc6db4dc0312f53447971776635f","user":{"login":"ankitjavalkar","id":4957402,"avatar_url":"https://avatars.githubusercontent.com/u/4957402?v=3","gravatar_id":"","url":"https://api.github.com/users/ankitjavalkar","html_url":"https://github.com/ankitjavalkar","followers_url":"https://api.github.com/users/ankitjavalkar/followers","following_url":"https://api.github.com/users/ankitjavalkar/following{/other_user}","gists_url":"https://api.github.com/users/ankitjavalkar/gists{/gist_id}","starred_url":"https://api.github.com/users/ankitjavalkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankitjavalkar/subscriptions","organizations_url":"https://api.github.com/users/ankitjavalkar/orgs","repos_url":"https://api.github.com/users/ankitjavalkar/repos","events_url":"https://api.github.com/users/ankitjavalkar/events{/privacy}","received_events_url":"https://api.github.com/users/ankitjavalkar/received_events","type":"User","site_admin":false},"body":"Please add;\r\nif file_names:\r\n    que._add_files_to_db(file_names)","created_at":"2016-08-25T10:48:20Z","updated_at":"2016-08-25T10:48:20Z","html_url":"https://github.com/FOSSEE/online_test/pull/127#discussion_r76221075","pull_request_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/127","_links":{"self":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments/76221075"},"html":{"href":"https://github.com/FOSSEE/online_test/pull/127#discussion_r76221075"},"pull_request":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/127"}}},"pull_request":{"url":"https://api.github.com/repos/FOSSEE/online_test/pulls/127","id":82531707,"html_url":"https://github.com/FOSSEE/online_test/pull/127","diff_url":"https://github.com/FOSSEE/online_test/pull/127.diff","patch_url":"https://github.com/FOSSEE/online_test/pull/127.patch","issue_url":"https://api.github.com/repos/FOSSEE/online_test/issues/127","number":127,"state":"open","locked":false,"title":"Create course fixtures","user":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"body":"Created a Fixture for creating Demo Course, Demo Quiz\r\nCreated a Management command to create Demo Course","created_at":"2016-08-24T12:20:21Z","updated_at":"2016-08-25T10:48:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c3c3a8d0fc9fbefd68bf3687be1c9b0c1067733","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/127/commits","review_comments_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/127/comments","review_comment_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FOSSEE/online_test/issues/127/comments","statuses_url":"https://api.github.com/repos/FOSSEE/online_test/statuses/c231dcb006c7dc6db4dc0312f53447971776635f","head":{"label":"adityacp:create_course_fixtures","ref":"create_course_fixtures","sha":"c231dcb006c7dc6db4dc0312f53447971776635f","user":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"repo":{"id":58149021,"name":"online_test","full_name":"adityacp/online_test","owner":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adityacp/online_test","description":"Online quiz/exam taking application. ","fork":true,"url":"https://api.github.com/repos/adityacp/online_test","forks_url":"https://api.github.com/repos/adityacp/online_test/forks","keys_url":"https://api.github.com/repos/adityacp/online_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adityacp/online_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adityacp/online_test/teams","hooks_url":"https://api.github.com/repos/adityacp/online_test/hooks","issue_events_url":"https://api.github.com/repos/adityacp/online_test/issues/events{/number}","events_url":"https://api.github.com/repos/adityacp/online_test/events","assignees_url":"https://api.github.com/repos/adityacp/online_test/assignees{/user}","branches_url":"https://api.github.com/repos/adityacp/online_test/branches{/branch}","tags_url":"https://api.github.com/repos/adityacp/online_test/tags","blobs_url":"https://api.github.com/repos/adityacp/online_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adityacp/online_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adityacp/online_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/adityacp/online_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adityacp/online_test/statuses/{sha}","languages_url":"https://api.github.com/repos/adityacp/online_test/languages","stargazers_url":"https://api.github.com/repos/adityacp/online_test/stargazers","contributors_url":"https://api.github.com/repos/adityacp/online_test/contributors","subscribers_url":"https://api.github.com/repos/adityacp/online_test/subscribers","subscription_url":"https://api.github.com/repos/adityacp/online_test/subscription","commits_url":"https://api.github.com/repos/adityacp/online_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/adityacp/online_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/adityacp/online_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/adityacp/online_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/adityacp/online_test/contents/{+path}","compare_url":"https://api.github.com/repos/adityacp/online_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adityacp/online_test/merges","archive_url":"https://api.github.com/repos/adityacp/online_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adityacp/online_test/downloads","issues_url":"https://api.github.com/repos/adityacp/online_test/issues{/number}","pulls_url":"https://api.github.com/repos/adityacp/online_test/pulls{/number}","milestones_url":"https://api.github.com/repos/adityacp/online_test/milestones{/number}","notifications_url":"https://api.github.com/repos/adityacp/online_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adityacp/online_test/labels{/name}","releases_url":"https://api.github.com/repos/adityacp/online_test/releases{/id}","deployments_url":"https://api.github.com/repos/adityacp/online_test/deployments","created_at":"2016-05-05T17:36:03Z","updated_at":"2016-05-05T17:36:04Z","pushed_at":"2016-08-24T12:11:58Z","git_url":"git://github.com/adityacp/online_test.git","ssh_url":"git@github.com:adityacp/online_test.git","clone_url":"https://github.com/adityacp/online_test.git","svn_url":"https://github.com/adityacp/online_test","homepage":"http://fossee.in","size":4974,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FOSSEE:master","ref":"master","sha":"9a9eb0d9d73cea1bdc6f8ff38631eb4bb664813b","user":{"login":"FOSSEE","id":703487,"avatar_url":"https://avatars.githubusercontent.com/u/703487?v=3","gravatar_id":"","url":"https://api.github.com/users/FOSSEE","html_url":"https://github.com/FOSSEE","followers_url":"https://api.github.com/users/FOSSEE/followers","following_url":"https://api.github.com/users/FOSSEE/following{/other_user}","gists_url":"https://api.github.com/users/FOSSEE/gists{/gist_id}","starred_url":"https://api.github.com/users/FOSSEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FOSSEE/subscriptions","organizations_url":"https://api.github.com/users/FOSSEE/orgs","repos_url":"https://api.github.com/users/FOSSEE/repos","events_url":"https://api.github.com/users/FOSSEE/events{/privacy}","received_events_url":"https://api.github.com/users/FOSSEE/received_events","type":"Organization","site_admin":false},"repo":{"id":2734092,"name":"online_test","full_name":"FOSSEE/online_test","owner":{"login":"FOSSEE","id":703487,"avatar_url":"https://avatars.githubusercontent.com/u/703487?v=3","gravatar_id":"","url":"https://api.github.com/users/FOSSEE","html_url":"https://github.com/FOSSEE","followers_url":"https://api.github.com/users/FOSSEE/followers","following_url":"https://api.github.com/users/FOSSEE/following{/other_user}","gists_url":"https://api.github.com/users/FOSSEE/gists{/gist_id}","starred_url":"https://api.github.com/users/FOSSEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FOSSEE/subscriptions","organizations_url":"https://api.github.com/users/FOSSEE/orgs","repos_url":"https://api.github.com/users/FOSSEE/repos","events_url":"https://api.github.com/users/FOSSEE/events{/privacy}","received_events_url":"https://api.github.com/users/FOSSEE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FOSSEE/online_test","description":"Online quiz/exam taking application. ","fork":false,"url":"https://api.github.com/repos/FOSSEE/online_test","forks_url":"https://api.github.com/repos/FOSSEE/online_test/forks","keys_url":"https://api.github.com/repos/FOSSEE/online_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FOSSEE/online_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FOSSEE/online_test/teams","hooks_url":"https://api.github.com/repos/FOSSEE/online_test/hooks","issue_events_url":"https://api.github.com/repos/FOSSEE/online_test/issues/events{/number}","events_url":"https://api.github.com/repos/FOSSEE/online_test/events","assignees_url":"https://api.github.com/repos/FOSSEE/online_test/assignees{/user}","branches_url":"https://api.github.com/repos/FOSSEE/online_test/branches{/branch}","tags_url":"https://api.github.com/repos/FOSSEE/online_test/tags","blobs_url":"https://api.github.com/repos/FOSSEE/online_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FOSSEE/online_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FOSSEE/online_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/FOSSEE/online_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FOSSEE/online_test/statuses/{sha}","languages_url":"https://api.github.com/repos/FOSSEE/online_test/languages","stargazers_url":"https://api.github.com/repos/FOSSEE/online_test/stargazers","contributors_url":"https://api.github.com/repos/FOSSEE/online_test/contributors","subscribers_url":"https://api.github.com/repos/FOSSEE/online_test/subscribers","subscription_url":"https://api.github.com/repos/FOSSEE/online_test/subscription","commits_url":"https://api.github.com/repos/FOSSEE/online_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/FOSSEE/online_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/FOSSEE/online_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/FOSSEE/online_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/FOSSEE/online_test/contents/{+path}","compare_url":"https://api.github.com/repos/FOSSEE/online_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FOSSEE/online_test/merges","archive_url":"https://api.github.com/repos/FOSSEE/online_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FOSSEE/online_test/downloads","issues_url":"https://api.github.com/repos/FOSSEE/online_test/issues{/number}","pulls_url":"https://api.github.com/repos/FOSSEE/online_test/pulls{/number}","milestones_url":"https://api.github.com/repos/FOSSEE/online_test/milestones{/number}","notifications_url":"https://api.github.com/repos/FOSSEE/online_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FOSSEE/online_test/labels{/name}","releases_url":"https://api.github.com/repos/FOSSEE/online_test/releases{/id}","deployments_url":"https://api.github.com/repos/FOSSEE/online_test/deployments","created_at":"2011-11-08T14:02:17Z","updated_at":"2016-08-05T11:54:06Z","pushed_at":"2016-08-24T12:20:21Z","git_url":"git://github.com/FOSSEE/online_test.git","ssh_url":"git@github.com:FOSSEE/online_test.git","clone_url":"https://github.com/FOSSEE/online_test.git","svn_url":"https://github.com/FOSSEE/online_test","homepage":"http://fossee.in","size":5217,"stargazers_count":28,"watchers_count":28,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":16,"forks":28,"open_issues":16,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/127"},"html":{"href":"https://github.com/FOSSEE/online_test/pull/127"},"issue":{"href":"https://api.github.com/repos/FOSSEE/online_test/issues/127"},"comments":{"href":"https://api.github.com/repos/FOSSEE/online_test/issues/127/comments"},"review_comments":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/127/comments"},"review_comment":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/127/commits"},"statuses":{"href":"https://api.github.com/repos/FOSSEE/online_test/statuses/c231dcb006c7dc6db4dc0312f53447971776635f"}}}}
{"actor":{"display_login":"ankitjavalkar"}}