{"action":"created","comment":{"url":"https://api.github.com/repos/mangaki/mangaki/pulls/comments/72973825","id":72973825,"diff_hunk":"@@ -110,6 +115,42 @@ class Meta:\n     def get_absolute_url(self):\n         return reverse('work-detail', args=[self.category.slug, str(self.id)])\n \n+    def retrieve_tags(self, anidb):\n+        anidb_tags_list = anidb.get(self.anidb_aid).tags\n+        anidb_tags = {title: int(weight) for title, weight in anidb_tags_list}\n+\n+        tag_work = TaggedWork.objects.filter(work=self)\n+        current_tags = {tagwork.tag.title: tagwork.weight for tagwork in tag_work}\n+\n+        deleted_tags_keys = current_tags.keys() - anidb_tags.keys()\n+        deleted_tags = {key: current_tags[key] for key in deleted_tags_keys}\n+\n+        added_tags_keys = anidb_tags.keys() - current_tags.keys()\n+        added_tags = dict((key, anidb_tags[key])for key in added_tags_keys)\n+\n+        remaining_tags_keys = anidb_tags.keys() & current_tags.keys()\n+        remaining_tags = dict((key, current_tags[key])for key in remaining_tags_keys)\n+\n+        updated_tags = {title: (current_tags[title], anidb_tags[title]) for title in remaining_tags if current_tags[title] != anidb_tags[title]}\n+        kept_tags = {title: current_tags[title] for title in remaining_tags if current_tags[title] == anidb_tags[title]}\n+\n+        retrieve_tags = {\"deleted_tags\": deleted_tags, \"added_tags\": added_tags, \"updated_tags\": updated_tags, \"kept_tags\": kept_tags}\n+\n+        return retrieve_tags\n+\n+    def update_tags(self, deleted_tags, added_tags, updated_tags):\n+        for title, weight in added_tags.items():\n+                    current_tag = Tag.objects.get_or_create(title=title)[0]","path":"mangaki/mangaki/models.py","position":84,"original_position":84,"commit_id":"e50ba369ce04c0fb7a1dd5bb1b0b155e80794b56","original_commit_id":"e50ba369ce04c0fb7a1dd5bb1b0b155e80794b56","user":{"login":"Elarnon","id":146210,"avatar_url":"https://avatars.githubusercontent.com/u/146210?v=3","gravatar_id":"","url":"https://api.github.com/users/Elarnon","html_url":"https://github.com/Elarnon","followers_url":"https://api.github.com/users/Elarnon/followers","following_url":"https://api.github.com/users/Elarnon/following{/other_user}","gists_url":"https://api.github.com/users/Elarnon/gists{/gist_id}","starred_url":"https://api.github.com/users/Elarnon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elarnon/subscriptions","organizations_url":"https://api.github.com/users/Elarnon/orgs","repos_url":"https://api.github.com/users/Elarnon/repos","events_url":"https://api.github.com/users/Elarnon/events{/privacy}","received_events_url":"https://api.github.com/users/Elarnon/received_events","type":"User","site_admin":false},"body":"Trop d'indentation.","created_at":"2016-08-01T13:04:07Z","updated_at":"2016-08-01T13:04:07Z","html_url":"https://github.com/mangaki/mangaki/pull/203#discussion_r72973825","pull_request_url":"https://api.github.com/repos/mangaki/mangaki/pulls/203","_links":{"self":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/comments/72973825"},"html":{"href":"https://github.com/mangaki/mangaki/pull/203#discussion_r72973825"},"pull_request":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/203"}}},"pull_request":{"url":"https://api.github.com/repos/mangaki/mangaki/pulls/203","id":77317291,"html_url":"https://github.com/mangaki/mangaki/pull/203","diff_url":"https://github.com/mangaki/mangaki/pull/203.diff","patch_url":"https://github.com/mangaki/mangaki/pull/203.patch","issue_url":"https://api.github.com/repos/mangaki/mangaki/issues/203","number":203,"state":"open","locked":false,"title":"Améliore l'intégration avec anidb","user":{"login":"Elarnon","id":146210,"avatar_url":"https://avatars.githubusercontent.com/u/146210?v=3","gravatar_id":"","url":"https://api.github.com/users/Elarnon","html_url":"https://github.com/Elarnon","followers_url":"https://api.github.com/users/Elarnon/followers","following_url":"https://api.github.com/users/Elarnon/following{/other_user}","gists_url":"https://api.github.com/users/Elarnon/gists{/gist_id}","starred_url":"https://api.github.com/users/Elarnon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elarnon/subscriptions","organizations_url":"https://api.github.com/users/Elarnon/orgs","repos_url":"https://api.github.com/users/Elarnon/repos","events_url":"https://api.github.com/users/Elarnon/events{/privacy}","received_events_url":"https://api.github.com/users/Elarnon/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-13T16:11:01Z","updated_at":"2016-08-01T13:04:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da735e485fb88f3ec47e562ece554074c29571e8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mangaki/mangaki/pulls/203/commits","review_comments_url":"https://api.github.com/repos/mangaki/mangaki/pulls/203/comments","review_comment_url":"https://api.github.com/repos/mangaki/mangaki/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mangaki/mangaki/issues/203/comments","statuses_url":"https://api.github.com/repos/mangaki/mangaki/statuses/e50ba369ce04c0fb7a1dd5bb1b0b155e80794b56","head":{"label":"mangaki:fravoi/anidb","ref":"fravoi/anidb","sha":"e50ba369ce04c0fb7a1dd5bb1b0b155e80794b56","user":{"login":"mangaki","id":16416680,"avatar_url":"https://avatars.githubusercontent.com/u/16416680?v=3","gravatar_id":"","url":"https://api.github.com/users/mangaki","html_url":"https://github.com/mangaki","followers_url":"https://api.github.com/users/mangaki/followers","following_url":"https://api.github.com/users/mangaki/following{/other_user}","gists_url":"https://api.github.com/users/mangaki/gists{/gist_id}","starred_url":"https://api.github.com/users/mangaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mangaki/subscriptions","organizations_url":"https://api.github.com/users/mangaki/orgs","repos_url":"https://api.github.com/users/mangaki/repos","events_url":"https://api.github.com/users/mangaki/events{/privacy}","received_events_url":"https://api.github.com/users/mangaki/received_events","type":"Organization","site_admin":false},"repo":{"id":48501368,"name":"mangaki","full_name":"mangaki/mangaki","owner":{"login":"mangaki","id":16416680,"avatar_url":"https://avatars.githubusercontent.com/u/16416680?v=3","gravatar_id":"","url":"https://api.github.com/users/mangaki","html_url":"https://github.com/mangaki","followers_url":"https://api.github.com/users/mangaki/followers","following_url":"https://api.github.com/users/mangaki/following{/other_user}","gists_url":"https://api.github.com/users/mangaki/gists{/gist_id}","starred_url":"https://api.github.com/users/mangaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mangaki/subscriptions","organizations_url":"https://api.github.com/users/mangaki/orgs","repos_url":"https://api.github.com/users/mangaki/repos","events_url":"https://api.github.com/users/mangaki/events{/privacy}","received_events_url":"https://api.github.com/users/mangaki/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mangaki/mangaki","description":"Site de recommandation de mangas et d'anime","fork":false,"url":"https://api.github.com/repos/mangaki/mangaki","forks_url":"https://api.github.com/repos/mangaki/mangaki/forks","keys_url":"https://api.github.com/repos/mangaki/mangaki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mangaki/mangaki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mangaki/mangaki/teams","hooks_url":"https://api.github.com/repos/mangaki/mangaki/hooks","issue_events_url":"https://api.github.com/repos/mangaki/mangaki/issues/events{/number}","events_url":"https://api.github.com/repos/mangaki/mangaki/events","assignees_url":"https://api.github.com/repos/mangaki/mangaki/assignees{/user}","branches_url":"https://api.github.com/repos/mangaki/mangaki/branches{/branch}","tags_url":"https://api.github.com/repos/mangaki/mangaki/tags","blobs_url":"https://api.github.com/repos/mangaki/mangaki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mangaki/mangaki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mangaki/mangaki/git/refs{/sha}","trees_url":"https://api.github.com/repos/mangaki/mangaki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mangaki/mangaki/statuses/{sha}","languages_url":"https://api.github.com/repos/mangaki/mangaki/languages","stargazers_url":"https://api.github.com/repos/mangaki/mangaki/stargazers","contributors_url":"https://api.github.com/repos/mangaki/mangaki/contributors","subscribers_url":"https://api.github.com/repos/mangaki/mangaki/subscribers","subscription_url":"https://api.github.com/repos/mangaki/mangaki/subscription","commits_url":"https://api.github.com/repos/mangaki/mangaki/commits{/sha}","git_commits_url":"https://api.github.com/repos/mangaki/mangaki/git/commits{/sha}","comments_url":"https://api.github.com/repos/mangaki/mangaki/comments{/number}","issue_comment_url":"https://api.github.com/repos/mangaki/mangaki/issues/comments{/number}","contents_url":"https://api.github.com/repos/mangaki/mangaki/contents/{+path}","compare_url":"https://api.github.com/repos/mangaki/mangaki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mangaki/mangaki/merges","archive_url":"https://api.github.com/repos/mangaki/mangaki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mangaki/mangaki/downloads","issues_url":"https://api.github.com/repos/mangaki/mangaki/issues{/number}","pulls_url":"https://api.github.com/repos/mangaki/mangaki/pulls{/number}","milestones_url":"https://api.github.com/repos/mangaki/mangaki/milestones{/number}","notifications_url":"https://api.github.com/repos/mangaki/mangaki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mangaki/mangaki/labels{/name}","releases_url":"https://api.github.com/repos/mangaki/mangaki/releases{/id}","deployments_url":"https://api.github.com/repos/mangaki/mangaki/deployments","created_at":"2015-12-23T16:55:03Z","updated_at":"2016-07-19T14:36:59Z","pushed_at":"2016-08-01T08:43:22Z","git_url":"git://github.com/mangaki/mangaki.git","ssh_url":"git@github.com:mangaki/mangaki.git","clone_url":"https://github.com/mangaki/mangaki.git","svn_url":"https://github.com/mangaki/mangaki","homepage":null,"size":10561,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":57,"forks":12,"open_issues":57,"watchers":23,"default_branch":"master"}},"base":{"label":"mangaki:master","ref":"master","sha":"e141f54bdf659af09e895d8680e85abf737c8eba","user":{"login":"mangaki","id":16416680,"avatar_url":"https://avatars.githubusercontent.com/u/16416680?v=3","gravatar_id":"","url":"https://api.github.com/users/mangaki","html_url":"https://github.com/mangaki","followers_url":"https://api.github.com/users/mangaki/followers","following_url":"https://api.github.com/users/mangaki/following{/other_user}","gists_url":"https://api.github.com/users/mangaki/gists{/gist_id}","starred_url":"https://api.github.com/users/mangaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mangaki/subscriptions","organizations_url":"https://api.github.com/users/mangaki/orgs","repos_url":"https://api.github.com/users/mangaki/repos","events_url":"https://api.github.com/users/mangaki/events{/privacy}","received_events_url":"https://api.github.com/users/mangaki/received_events","type":"Organization","site_admin":false},"repo":{"id":48501368,"name":"mangaki","full_name":"mangaki/mangaki","owner":{"login":"mangaki","id":16416680,"avatar_url":"https://avatars.githubusercontent.com/u/16416680?v=3","gravatar_id":"","url":"https://api.github.com/users/mangaki","html_url":"https://github.com/mangaki","followers_url":"https://api.github.com/users/mangaki/followers","following_url":"https://api.github.com/users/mangaki/following{/other_user}","gists_url":"https://api.github.com/users/mangaki/gists{/gist_id}","starred_url":"https://api.github.com/users/mangaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mangaki/subscriptions","organizations_url":"https://api.github.com/users/mangaki/orgs","repos_url":"https://api.github.com/users/mangaki/repos","events_url":"https://api.github.com/users/mangaki/events{/privacy}","received_events_url":"https://api.github.com/users/mangaki/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mangaki/mangaki","description":"Site de recommandation de mangas et d'anime","fork":false,"url":"https://api.github.com/repos/mangaki/mangaki","forks_url":"https://api.github.com/repos/mangaki/mangaki/forks","keys_url":"https://api.github.com/repos/mangaki/mangaki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mangaki/mangaki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mangaki/mangaki/teams","hooks_url":"https://api.github.com/repos/mangaki/mangaki/hooks","issue_events_url":"https://api.github.com/repos/mangaki/mangaki/issues/events{/number}","events_url":"https://api.github.com/repos/mangaki/mangaki/events","assignees_url":"https://api.github.com/repos/mangaki/mangaki/assignees{/user}","branches_url":"https://api.github.com/repos/mangaki/mangaki/branches{/branch}","tags_url":"https://api.github.com/repos/mangaki/mangaki/tags","blobs_url":"https://api.github.com/repos/mangaki/mangaki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mangaki/mangaki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mangaki/mangaki/git/refs{/sha}","trees_url":"https://api.github.com/repos/mangaki/mangaki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mangaki/mangaki/statuses/{sha}","languages_url":"https://api.github.com/repos/mangaki/mangaki/languages","stargazers_url":"https://api.github.com/repos/mangaki/mangaki/stargazers","contributors_url":"https://api.github.com/repos/mangaki/mangaki/contributors","subscribers_url":"https://api.github.com/repos/mangaki/mangaki/subscribers","subscription_url":"https://api.github.com/repos/mangaki/mangaki/subscription","commits_url":"https://api.github.com/repos/mangaki/mangaki/commits{/sha}","git_commits_url":"https://api.github.com/repos/mangaki/mangaki/git/commits{/sha}","comments_url":"https://api.github.com/repos/mangaki/mangaki/comments{/number}","issue_comment_url":"https://api.github.com/repos/mangaki/mangaki/issues/comments{/number}","contents_url":"https://api.github.com/repos/mangaki/mangaki/contents/{+path}","compare_url":"https://api.github.com/repos/mangaki/mangaki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mangaki/mangaki/merges","archive_url":"https://api.github.com/repos/mangaki/mangaki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mangaki/mangaki/downloads","issues_url":"https://api.github.com/repos/mangaki/mangaki/issues{/number}","pulls_url":"https://api.github.com/repos/mangaki/mangaki/pulls{/number}","milestones_url":"https://api.github.com/repos/mangaki/mangaki/milestones{/number}","notifications_url":"https://api.github.com/repos/mangaki/mangaki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mangaki/mangaki/labels{/name}","releases_url":"https://api.github.com/repos/mangaki/mangaki/releases{/id}","deployments_url":"https://api.github.com/repos/mangaki/mangaki/deployments","created_at":"2015-12-23T16:55:03Z","updated_at":"2016-07-19T14:36:59Z","pushed_at":"2016-08-01T08:43:22Z","git_url":"git://github.com/mangaki/mangaki.git","ssh_url":"git@github.com:mangaki/mangaki.git","clone_url":"https://github.com/mangaki/mangaki.git","svn_url":"https://github.com/mangaki/mangaki","homepage":null,"size":10561,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":57,"forks":12,"open_issues":57,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/203"},"html":{"href":"https://github.com/mangaki/mangaki/pull/203"},"issue":{"href":"https://api.github.com/repos/mangaki/mangaki/issues/203"},"comments":{"href":"https://api.github.com/repos/mangaki/mangaki/issues/203/comments"},"review_comments":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/203/comments"},"review_comment":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/203/commits"},"statuses":{"href":"https://api.github.com/repos/mangaki/mangaki/statuses/e50ba369ce04c0fb7a1dd5bb1b0b155e80794b56"}}}}
{"actor":{"display_login":"Elarnon"}}