{"action":"created","comment":{"url":"https://api.github.com/repos/mangaki/mangaki/pulls/comments/59970105","id":59970105,"diff_hunk":"@@ -103,38 +103,41 @@ def update_score_while_unrating(user, work, choice):\n             Profile.objects.filter(user=reco.user).update(score=reco.user.profile.score)\n \n \n-class AnimeDetail(AjaxableResponseMixin, FormMixin, DetailView):\n-    queryset = Anime.objects.prefetch_related('staff_set__role', 'staff_set__artist')\n+class WorkDetail(AjaxableResponseMixin, FormMixin, DetailView):\n     form_class = SuggestionForm\n \n     def get_success_url(self):\n-        return 'anime/%d' % self.object.pk\n+        return self.object.get_absolute_url()\n+\n+    def get_queryset(self):\n+        queryset = Work.objects.prefetch_related('staff_set__role', 'staff_set__artist', 'category')\n+        category = self.kwargs.get('category', None)\n+        if category is not None:\n+            queryset = queryset.filter(category__slug=category)\n+        return queryset\n \n     def get_context_data(self, **kwargs):\n-        context = super(AnimeDetail, self).get_context_data(**kwargs)\n-        anime = self.object\n-        update_poster_if_nsfw(anime, self.request.user)\n-        context['object'].source = anime.source.split(',')[0]\n-\n-        genres = []\n-        for genre in anime.genre.all():\n-            genres.append(genre.title)\n+        context = super().get_context_data(**kwargs)\n+        update_poster_if_nsfw(self.object, self.request.user)\n+        self.object.source = self.object.source.split(',')[0]\n+\n+        genres = [genre.title for genre in self.object.genre.all()]","path":"mangaki/mangaki/views.py","position":33,"original_position":33,"commit_id":"65687392f255e642f533abcc8a130e7d0f8d2c63","original_commit_id":"65687392f255e642f533abcc8a130e7d0f8d2c63","user":{"login":"RaitoBezarius","id":314564,"avatar_url":"https://avatars.githubusercontent.com/u/314564?v=3","gravatar_id":"","url":"https://api.github.com/users/RaitoBezarius","html_url":"https://github.com/RaitoBezarius","followers_url":"https://api.github.com/users/RaitoBezarius/followers","following_url":"https://api.github.com/users/RaitoBezarius/following{/other_user}","gists_url":"https://api.github.com/users/RaitoBezarius/gists{/gist_id}","starred_url":"https://api.github.com/users/RaitoBezarius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaitoBezarius/subscriptions","organizations_url":"https://api.github.com/users/RaitoBezarius/orgs","repos_url":"https://api.github.com/users/RaitoBezarius/repos","events_url":"https://api.github.com/users/RaitoBezarius/events{/privacy}","received_events_url":"https://api.github.com/users/RaitoBezarius/received_events","type":"User","site_admin":false},"body":"Il est probablement plus intéressant d'avoir une generator expression ici, `str.join` prend un `iterable`, non? (même si je sais pas si ça a un réel intérêt ou non).","created_at":"2016-04-16T16:37:31Z","updated_at":"2016-04-16T16:37:31Z","html_url":"https://github.com/mangaki/mangaki/pull/159#discussion_r59970105","pull_request_url":"https://api.github.com/repos/mangaki/mangaki/pulls/159","_links":{"self":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/comments/59970105"},"html":{"href":"https://github.com/mangaki/mangaki/pull/159#discussion_r59970105"},"pull_request":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/159"}}},"pull_request":{"url":"https://api.github.com/repos/mangaki/mangaki/pulls/159","id":66734094,"html_url":"https://github.com/mangaki/mangaki/pull/159","diff_url":"https://github.com/mangaki/mangaki/pull/159.diff","patch_url":"https://github.com/mangaki/mangaki/pull/159.patch","issue_url":"https://api.github.com/repos/mangaki/mangaki/issues/159","number":159,"state":"open","locked":false,"title":"Create a generic WorkDetail view","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":"Currently we have separate AnimeDetail, MangaDetail, and AlbumDetail\r\nviews with a copious amount of duplication. This commits changes it so\r\nthat there is a single WorkDetail view handling all of the work\r\ncategories, present and future.","created_at":"2016-04-16T10:16:00Z","updated_at":"2016-04-16T16:37:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ecec2f54f5832eb13c863e0f8863f0382b385e64","assignee":null,"milestone":{"url":"https://api.github.com/repos/mangaki/mangaki/milestones/2","html_url":"https://github.com/mangaki/mangaki/milestones/0.1","labels_url":"https://api.github.com/repos/mangaki/mangaki/milestones/2/labels","id":1695334,"number":2,"title":"0.1","description":"","creator":{"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},"open_issues":21,"closed_issues":3,"state":"open","created_at":"2016-04-09T16:30:01Z","updated_at":"2016-04-16T10:21:19Z","due_on":"2016-05-07T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mangaki/mangaki/pulls/159/commits","review_comments_url":"https://api.github.com/repos/mangaki/mangaki/pulls/159/comments","review_comment_url":"https://api.github.com/repos/mangaki/mangaki/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mangaki/mangaki/issues/159/comments","statuses_url":"https://api.github.com/repos/mangaki/mangaki/statuses/65687392f255e642f533abcc8a130e7d0f8d2c63","head":{"label":"mangaki:Elarnon/work-detail","ref":"Elarnon/work-detail","sha":"65687392f255e642f533abcc8a130e7d0f8d2c63","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-03-09T22:34:19Z","pushed_at":"2016-04-16T10:20:30Z","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":6705,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":66,"forks":7,"open_issues":66,"watchers":14,"default_branch":"master"}},"base":{"label":"mangaki:Elarnon/merge-work-db","ref":"Elarnon/merge-work-db","sha":"b8a6aee687e6691d165f6ac865166398351a92fa","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-03-09T22:34:19Z","pushed_at":"2016-04-16T10:20:30Z","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":6705,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":66,"forks":7,"open_issues":66,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/159"},"html":{"href":"https://github.com/mangaki/mangaki/pull/159"},"issue":{"href":"https://api.github.com/repos/mangaki/mangaki/issues/159"},"comments":{"href":"https://api.github.com/repos/mangaki/mangaki/issues/159/comments"},"review_comments":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/159/comments"},"review_comment":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mangaki/mangaki/pulls/159/commits"},"statuses":{"href":"https://api.github.com/repos/mangaki/mangaki/statuses/65687392f255e642f533abcc8a130e7d0f8d2c63"}}}}