{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/kuma/pulls/comments/76160809","id":76160809,"diff_hunk":"@@ -22,7 +22,7 @@ def render_done_handler(**kwargs):\n         if outdated:\n             log.info('Found a newer index and scheduled '\n                      'indexing it after promotion.')\n-        doc_pks = set(doc.other_translations.values_list('pk', flat=True))\n+        doc_pks = set([item.pk for item in doc.other_translations])","path":"kuma/search/signals.py","position":5,"original_position":5,"commit_id":"7ae839157852e1b69addf0bb1c7dba2ab1e65dd7","original_commit_id":"7ae839157852e1b69addf0bb1c7dba2ab1e65dd7","user":{"login":"safwanrahman","id":7114151,"avatar_url":"https://avatars.githubusercontent.com/u/7114151?v=3","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"body":"In the previous version, ``doc.other_translations`` would return a queryset instead of a list. so we can just get the ``pk`` in list. The previous version had the correct result, but it was not sorted and document was in random order.\r\nMoreover, if you take closer look in the ``other_translations`` model function, you will see two sql quires was being made to generate this in the past solution. this solution works with only single query","created_at":"2016-08-24T23:55:58Z","updated_at":"2016-08-24T23:55:58Z","html_url":"https://github.com/mozilla/kuma/pull/3947#discussion_r76160809","pull_request_url":"https://api.github.com/repos/mozilla/kuma/pulls/3947","_links":{"self":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/comments/76160809"},"html":{"href":"https://github.com/mozilla/kuma/pull/3947#discussion_r76160809"},"pull_request":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3947"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/kuma/pulls/3947","id":82435387,"html_url":"https://github.com/mozilla/kuma/pull/3947","diff_url":"https://github.com/mozilla/kuma/pull/3947.diff","patch_url":"https://github.com/mozilla/kuma/pull/3947.patch","issue_url":"https://api.github.com/repos/mozilla/kuma/issues/3947","number":3947,"state":"open","locked":false,"title":"[Bug 1294904] Language drop down menus should be sorted","user":{"login":"safwanrahman","id":7114151,"avatar_url":"https://avatars.githubusercontent.com/u/7114151?v=3","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"body":"So I have changed the way ``other_translations`` model function works. It should return a ``list``, but it was returning ``queryset``. It was done intentionally at #1953. Reading the conversation, got that it was changed because of hard to test. But, now I have seen some test for this function and I have changed the test to test the functionality with ``list`` instead of ``queryset``.\r\n\r\nIn order to change ``other_translations`` model function, I need to change the ``search/signals.py\r\n`` so nothing will break.\r\n\r\nAdding total 3 template tests so that we don't get regression in the future. I hope it works\r\n\r\nThough the affect will be in the frontend, most of the changes are in the backend. so @jwhitlock r?","created_at":"2016-08-23T20:30:35Z","updated_at":"2016-08-24T23:55:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"452591ebb3664fcee0800dec1fa0e5dc9e4cf7f0","assignee":{"login":"jwhitlock","id":286017,"avatar_url":"https://avatars.githubusercontent.com/u/286017?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitlock","html_url":"https://github.com/jwhitlock","followers_url":"https://api.github.com/users/jwhitlock/followers","following_url":"https://api.github.com/users/jwhitlock/following{/other_user}","gists_url":"https://api.github.com/users/jwhitlock/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitlock/subscriptions","organizations_url":"https://api.github.com/users/jwhitlock/orgs","repos_url":"https://api.github.com/users/jwhitlock/repos","events_url":"https://api.github.com/users/jwhitlock/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitlock/received_events","type":"User","site_admin":false},"assignees":[{"login":"jwhitlock","id":286017,"avatar_url":"https://avatars.githubusercontent.com/u/286017?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitlock","html_url":"https://github.com/jwhitlock","followers_url":"https://api.github.com/users/jwhitlock/followers","following_url":"https://api.github.com/users/jwhitlock/following{/other_user}","gists_url":"https://api.github.com/users/jwhitlock/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitlock/subscriptions","organizations_url":"https://api.github.com/users/jwhitlock/orgs","repos_url":"https://api.github.com/users/jwhitlock/repos","events_url":"https://api.github.com/users/jwhitlock/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitlock/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/kuma/pulls/3947/commits","review_comments_url":"https://api.github.com/repos/mozilla/kuma/pulls/3947/comments","review_comment_url":"https://api.github.com/repos/mozilla/kuma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/kuma/issues/3947/comments","statuses_url":"https://api.github.com/repos/mozilla/kuma/statuses/7ae839157852e1b69addf0bb1c7dba2ab1e65dd7","head":{"label":"safwanrahman:sorted","ref":"sorted","sha":"7ae839157852e1b69addf0bb1c7dba2ab1e65dd7","user":{"login":"safwanrahman","id":7114151,"avatar_url":"https://avatars.githubusercontent.com/u/7114151?v=3","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"repo":{"id":34012811,"name":"kuma","full_name":"safwanrahman/kuma","owner":{"login":"safwanrahman","id":7114151,"avatar_url":"https://avatars.githubusercontent.com/u/7114151?v=3","gravatar_id":"","url":"https://api.github.com/users/safwanrahman","html_url":"https://github.com/safwanrahman","followers_url":"https://api.github.com/users/safwanrahman/followers","following_url":"https://api.github.com/users/safwanrahman/following{/other_user}","gists_url":"https://api.github.com/users/safwanrahman/gists{/gist_id}","starred_url":"https://api.github.com/users/safwanrahman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/safwanrahman/subscriptions","organizations_url":"https://api.github.com/users/safwanrahman/orgs","repos_url":"https://api.github.com/users/safwanrahman/repos","events_url":"https://api.github.com/users/safwanrahman/events{/privacy}","received_events_url":"https://api.github.com/users/safwanrahman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/safwanrahman/kuma","description":"The Django project that powers MDN.","fork":true,"url":"https://api.github.com/repos/safwanrahman/kuma","forks_url":"https://api.github.com/repos/safwanrahman/kuma/forks","keys_url":"https://api.github.com/repos/safwanrahman/kuma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/safwanrahman/kuma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/safwanrahman/kuma/teams","hooks_url":"https://api.github.com/repos/safwanrahman/kuma/hooks","issue_events_url":"https://api.github.com/repos/safwanrahman/kuma/issues/events{/number}","events_url":"https://api.github.com/repos/safwanrahman/kuma/events","assignees_url":"https://api.github.com/repos/safwanrahman/kuma/assignees{/user}","branches_url":"https://api.github.com/repos/safwanrahman/kuma/branches{/branch}","tags_url":"https://api.github.com/repos/safwanrahman/kuma/tags","blobs_url":"https://api.github.com/repos/safwanrahman/kuma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/safwanrahman/kuma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/safwanrahman/kuma/git/refs{/sha}","trees_url":"https://api.github.com/repos/safwanrahman/kuma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/safwanrahman/kuma/statuses/{sha}","languages_url":"https://api.github.com/repos/safwanrahman/kuma/languages","stargazers_url":"https://api.github.com/repos/safwanrahman/kuma/stargazers","contributors_url":"https://api.github.com/repos/safwanrahman/kuma/contributors","subscribers_url":"https://api.github.com/repos/safwanrahman/kuma/subscribers","subscription_url":"https://api.github.com/repos/safwanrahman/kuma/subscription","commits_url":"https://api.github.com/repos/safwanrahman/kuma/commits{/sha}","git_commits_url":"https://api.github.com/repos/safwanrahman/kuma/git/commits{/sha}","comments_url":"https://api.github.com/repos/safwanrahman/kuma/comments{/number}","issue_comment_url":"https://api.github.com/repos/safwanrahman/kuma/issues/comments{/number}","contents_url":"https://api.github.com/repos/safwanrahman/kuma/contents/{+path}","compare_url":"https://api.github.com/repos/safwanrahman/kuma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/safwanrahman/kuma/merges","archive_url":"https://api.github.com/repos/safwanrahman/kuma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/safwanrahman/kuma/downloads","issues_url":"https://api.github.com/repos/safwanrahman/kuma/issues{/number}","pulls_url":"https://api.github.com/repos/safwanrahman/kuma/pulls{/number}","milestones_url":"https://api.github.com/repos/safwanrahman/kuma/milestones{/number}","notifications_url":"https://api.github.com/repos/safwanrahman/kuma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/safwanrahman/kuma/labels{/name}","releases_url":"https://api.github.com/repos/safwanrahman/kuma/releases{/id}","deployments_url":"https://api.github.com/repos/safwanrahman/kuma/deployments","created_at":"2015-04-15T19:00:51Z","updated_at":"2016-05-08T19:44:31Z","pushed_at":"2016-08-23T20:22:11Z","git_url":"git://github.com/safwanrahman/kuma.git","ssh_url":"git@github.com:safwanrahman/kuma.git","clone_url":"https://github.com/safwanrahman/kuma.git","svn_url":"https://github.com/safwanrahman/kuma","homepage":"https://developer.mozilla.org","size":164331,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"mozilla:master","ref":"master","sha":"35e2cb99c01177bddd67e179cc46acf897bc7e48","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1352520,"name":"kuma","full_name":"mozilla/kuma","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/kuma","description":"The project that powers MDN.","fork":false,"url":"https://api.github.com/repos/mozilla/kuma","forks_url":"https://api.github.com/repos/mozilla/kuma/forks","keys_url":"https://api.github.com/repos/mozilla/kuma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/kuma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/kuma/teams","hooks_url":"https://api.github.com/repos/mozilla/kuma/hooks","issue_events_url":"https://api.github.com/repos/mozilla/kuma/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/kuma/events","assignees_url":"https://api.github.com/repos/mozilla/kuma/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/kuma/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/kuma/tags","blobs_url":"https://api.github.com/repos/mozilla/kuma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/kuma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/kuma/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/kuma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/kuma/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/kuma/languages","stargazers_url":"https://api.github.com/repos/mozilla/kuma/stargazers","contributors_url":"https://api.github.com/repos/mozilla/kuma/contributors","subscribers_url":"https://api.github.com/repos/mozilla/kuma/subscribers","subscription_url":"https://api.github.com/repos/mozilla/kuma/subscription","commits_url":"https://api.github.com/repos/mozilla/kuma/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/kuma/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/kuma/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/kuma/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/kuma/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/kuma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/kuma/merges","archive_url":"https://api.github.com/repos/mozilla/kuma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/kuma/downloads","issues_url":"https://api.github.com/repos/mozilla/kuma/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/kuma/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/kuma/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/kuma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/kuma/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/kuma/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/kuma/deployments","created_at":"2011-02-10T21:48:06Z","updated_at":"2016-08-23T04:39:19Z","pushed_at":"2016-08-24T22:35:32Z","git_url":"git://github.com/mozilla/kuma.git","ssh_url":"git@github.com:mozilla/kuma.git","clone_url":"https://github.com/mozilla/kuma.git","svn_url":"https://github.com/mozilla/kuma","homepage":"https://developer.mozilla.org","size":178948,"stargazers_count":838,"watchers_count":838,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":517,"mirror_url":null,"open_issues_count":15,"forks":517,"open_issues":15,"watchers":838,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3947"},"html":{"href":"https://github.com/mozilla/kuma/pull/3947"},"issue":{"href":"https://api.github.com/repos/mozilla/kuma/issues/3947"},"comments":{"href":"https://api.github.com/repos/mozilla/kuma/issues/3947/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3947/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3947/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/kuma/statuses/7ae839157852e1b69addf0bb1c7dba2ab1e65dd7"}}}}
{"actor":{"display_login":"safwanrahman"}}