{"action":"created","comment":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/54122985","id":54122985,"diff_hunk":"@@ -123,6 +125,55 @@ class ConceptViewSet(viewsets.ModelViewSet):\n     def get_queryset(self):\n         return models.Concept.objects\n \n+    @list_route(methods=['POST'])\n+    def import_csv(self, request):\n+        if 'csv' not in request.FILES:\n+            return JsonResponse(\n+                status=status.HTTP_400_BAD_REQUEST,\n+                data={\n+                    'success': False,\n+                    'errors': [\"Missing 'csv' parameter\"]\n+                }\n+            )\n+\n+        csv = request.FILES['csv']\n+\n+        file_path = \"/tmp/{0}.csv\".format(str(uuid.uuid4()))\n+\n+        with open(file_path, 'wb+') as destination:\n+            for chunk in csv.chunks():\n+                destination.write(chunk)\n+\n+        try:\n+            copy_mapping = CopyMapping(\n+                models.Concept,\n+                file_path,\n+                dict(","path":"src-django/api/views.py","position":43,"original_position":43,"commit_id":"6e2cdea173f2433e539208a473e309f93c1b9a9a","original_commit_id":"6e2cdea173f2433e539208a473e309f93c1b9a9a","user":{"login":"connorcimowsky","id":443395,"avatar_url":"https://avatars.githubusercontent.com/u/443395?v=3","gravatar_id":"","url":"https://api.github.com/users/connorcimowsky","html_url":"https://github.com/connorcimowsky","followers_url":"https://api.github.com/users/connorcimowsky/followers","following_url":"https://api.github.com/users/connorcimowsky/following{/other_user}","gists_url":"https://api.github.com/users/connorcimowsky/gists{/gist_id}","starred_url":"https://api.github.com/users/connorcimowsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorcimowsky/subscriptions","organizations_url":"https://api.github.com/users/connorcimowsky/orgs","repos_url":"https://api.github.com/users/connorcimowsky/repos","events_url":"https://api.github.com/users/connorcimowsky/events{/privacy}","received_events_url":"https://api.github.com/users/connorcimowsky/received_events","type":"User","site_admin":false},"body":"No reason, just copied example code. Changed to `{}` and moved into a constant.","created_at":"2016-02-25T16:34:43Z","updated_at":"2016-02-25T16:34:43Z","html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/347#discussion_r54122985","pull_request_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347","_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/54122985"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/347#discussion_r54122985"},"pull_request":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347"}}},"pull_request":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347","id":60602236,"html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/347","diff_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/347.diff","patch_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/347.patch","issue_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/347","number":347,"state":"open","locked":false,"title":"Add CSV upload functionality to the backend","user":{"login":"connorcimowsky","id":443395,"avatar_url":"https://avatars.githubusercontent.com/u/443395?v=3","gravatar_id":"","url":"https://api.github.com/users/connorcimowsky","html_url":"https://github.com/connorcimowsky","followers_url":"https://api.github.com/users/connorcimowsky/followers","following_url":"https://api.github.com/users/connorcimowsky/following{/other_user}","gists_url":"https://api.github.com/users/connorcimowsky/gists{/gist_id}","starred_url":"https://api.github.com/users/connorcimowsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorcimowsky/subscriptions","organizations_url":"https://api.github.com/users/connorcimowsky/orgs","repos_url":"https://api.github.com/users/connorcimowsky/repos","events_url":"https://api.github.com/users/connorcimowsky/events{/privacy}","received_events_url":"https://api.github.com/users/connorcimowsky/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-25T00:05:36Z","updated_at":"2016-02-25T16:34:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"579350b674d287206724cde12bc1534af6a2f529","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347/commits","review_comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347/comments","review_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/347/comments","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/6e2cdea173f2433e539208a473e309f93c1b9a9a","head":{"label":"SanaMobile:connor/csv","ref":"connor/csv","sha":"6e2cdea173f2433e539208a473e309f93c1b9a9a","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","deployments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/deployments","created_at":"2014-10-10T01:24:58Z","updated_at":"2016-02-24T03:35:03Z","pushed_at":"2016-02-25T15:57:19Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":5689,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":4,"default_branch":"master"}},"base":{"label":"SanaMobile:master","ref":"master","sha":"dd4c5188d0875b250e2ab8fc034a27da94859ed4","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","deployments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/deployments","created_at":"2014-10-10T01:24:58Z","updated_at":"2016-02-24T03:35:03Z","pushed_at":"2016-02-25T15:57:19Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":5689,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/347"},"issue":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/347"},"comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/347/comments"},"review_comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347/comments"},"review_comment":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/347/commits"},"statuses":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/6e2cdea173f2433e539208a473e309f93c1b9a9a"}}}}