{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/27354306","id":27354306,"diff_hunk":"@@ -436,6 +489,42 @@ def generate_renamed_models(self):\n                             self.old_model_keys.append((app_label, model_name))\n                             break\n \n+    def m2m_field_compare(self, through, rem_through):\n+        return (\n+            through[\"from\"] == rem_through[\"from\"]\n+            and through[\"to\"] == rem_through[\"to\"]\n+            and through[\"field\"] == rem_through[\"field\"]\n+        )\n+\n+    def generate_renamed_through_models(self):\n+        for app_label, model_name in sorted(self.new_through_models):","path":"django/db/migrations/autodetector.py","position":85,"original_position":85,"commit_id":"0f38b067a98a2a05c9f173566a0c0bfcc04e90c1","original_commit_id":"0f38b067a98a2a05c9f173566a0c0bfcc04e90c1","user":{"login":"MarkusH","id":475613,"avatar_url":"https://avatars.githubusercontent.com/u/475613?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkusH","html_url":"https://github.com/MarkusH","followers_url":"https://api.github.com/users/MarkusH/followers","following_url":"https://api.github.com/users/MarkusH/following{/other_user}","gists_url":"https://api.github.com/users/MarkusH/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkusH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkusH/subscriptions","organizations_url":"https://api.github.com/users/MarkusH/orgs","repos_url":"https://api.github.com/users/MarkusH/repos","events_url":"https://api.github.com/users/MarkusH/events{/privacy}","received_events_url":"https://api.github.com/users/MarkusH/received_events","type":"User","site_admin":false},"body":"`for (app_label, model_name), through in sorted(self.new_through_models.items()):` saves you the next line and is still readable.","created_at":"2015-03-29T13:01:40Z","updated_at":"2015-03-29T13:01:40Z","html_url":"https://github.com/django/django/pull/4312#discussion_r27354306","pull_request_url":"https://api.github.com/repos/django/django/pulls/4312","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/27354306"},"html":{"href":"https://github.com/django/django/pull/4312#discussion_r27354306"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/4312"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/4312","id":31128964,"html_url":"https://github.com/django/django/pull/4312","diff_url":"https://github.com/django/django/pull/4312.diff","patch_url":"https://github.com/django/django/pull/4312.patch","issue_url":"https://api.github.com/repos/django/django/issues/4312","number":4312,"state":"open","locked":false,"title":"Fixed #23034 -- Added migration support for ManyToMany through model.","user":{"login":"knbk","id":3515299,"avatar_url":"https://avatars.githubusercontent.com/u/3515299?v=3","gravatar_id":"","url":"https://api.github.com/users/knbk","html_url":"https://github.com/knbk","followers_url":"https://api.github.com/users/knbk/followers","following_url":"https://api.github.com/users/knbk/following{/other_user}","gists_url":"https://api.github.com/users/knbk/gists{/gist_id}","starred_url":"https://api.github.com/users/knbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knbk/subscriptions","organizations_url":"https://api.github.com/users/knbk/orgs","repos_url":"https://api.github.com/users/knbk/repos","events_url":"https://api.github.com/users/knbk/events{/privacy}","received_events_url":"https://api.github.com/users/knbk/received_events","type":"User","site_admin":false},"body":"Added auto-created models to project state, while preventing\r\nconventional creation/deletion as this is handled elsewhere.\r\nThis allows the auto-detector to pick up any changes to custom\r\nor auto-created through models. Added support for switching\r\nbetween the two by explicitly renaming through models in a specific\r\nmany-to-many field.\r\n\r\nhttps://code.djangoproject.com/ticket/23034","created_at":"2015-03-13T14:17:08Z","updated_at":"2015-03-29T13:01:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10be2f9b8248928934ff44e206c66f8a175e3968","assignee":{"login":"MarkusH","id":475613,"avatar_url":"https://avatars.githubusercontent.com/u/475613?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkusH","html_url":"https://github.com/MarkusH","followers_url":"https://api.github.com/users/MarkusH/followers","following_url":"https://api.github.com/users/MarkusH/following{/other_user}","gists_url":"https://api.github.com/users/MarkusH/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkusH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkusH/subscriptions","organizations_url":"https://api.github.com/users/MarkusH/orgs","repos_url":"https://api.github.com/users/MarkusH/repos","events_url":"https://api.github.com/users/MarkusH/events{/privacy}","received_events_url":"https://api.github.com/users/MarkusH/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/4312/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/4312/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/4312/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/0f38b067a98a2a05c9f173566a0c0bfcc04e90c1","head":{"label":"knbk:ticket_23034_new","ref":"ticket_23034_new","sha":"0f38b067a98a2a05c9f173566a0c0bfcc04e90c1","user":{"login":"knbk","id":3515299,"avatar_url":"https://avatars.githubusercontent.com/u/3515299?v=3","gravatar_id":"","url":"https://api.github.com/users/knbk","html_url":"https://github.com/knbk","followers_url":"https://api.github.com/users/knbk/followers","following_url":"https://api.github.com/users/knbk/following{/other_user}","gists_url":"https://api.github.com/users/knbk/gists{/gist_id}","starred_url":"https://api.github.com/users/knbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knbk/subscriptions","organizations_url":"https://api.github.com/users/knbk/orgs","repos_url":"https://api.github.com/users/knbk/repos","events_url":"https://api.github.com/users/knbk/events{/privacy}","received_events_url":"https://api.github.com/users/knbk/received_events","type":"User","site_admin":false},"repo":{"id":30277791,"name":"django","full_name":"knbk/django","owner":{"login":"knbk","id":3515299,"avatar_url":"https://avatars.githubusercontent.com/u/3515299?v=3","gravatar_id":"","url":"https://api.github.com/users/knbk","html_url":"https://github.com/knbk","followers_url":"https://api.github.com/users/knbk/followers","following_url":"https://api.github.com/users/knbk/following{/other_user}","gists_url":"https://api.github.com/users/knbk/gists{/gist_id}","starred_url":"https://api.github.com/users/knbk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knbk/subscriptions","organizations_url":"https://api.github.com/users/knbk/orgs","repos_url":"https://api.github.com/users/knbk/repos","events_url":"https://api.github.com/users/knbk/events{/privacy}","received_events_url":"https://api.github.com/users/knbk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/knbk/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/knbk/django","forks_url":"https://api.github.com/repos/knbk/django/forks","keys_url":"https://api.github.com/repos/knbk/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knbk/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knbk/django/teams","hooks_url":"https://api.github.com/repos/knbk/django/hooks","issue_events_url":"https://api.github.com/repos/knbk/django/issues/events{/number}","events_url":"https://api.github.com/repos/knbk/django/events","assignees_url":"https://api.github.com/repos/knbk/django/assignees{/user}","branches_url":"https://api.github.com/repos/knbk/django/branches{/branch}","tags_url":"https://api.github.com/repos/knbk/django/tags","blobs_url":"https://api.github.com/repos/knbk/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knbk/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knbk/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/knbk/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knbk/django/statuses/{sha}","languages_url":"https://api.github.com/repos/knbk/django/languages","stargazers_url":"https://api.github.com/repos/knbk/django/stargazers","contributors_url":"https://api.github.com/repos/knbk/django/contributors","subscribers_url":"https://api.github.com/repos/knbk/django/subscribers","subscription_url":"https://api.github.com/repos/knbk/django/subscription","commits_url":"https://api.github.com/repos/knbk/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/knbk/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/knbk/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/knbk/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/knbk/django/contents/{+path}","compare_url":"https://api.github.com/repos/knbk/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knbk/django/merges","archive_url":"https://api.github.com/repos/knbk/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knbk/django/downloads","issues_url":"https://api.github.com/repos/knbk/django/issues{/number}","pulls_url":"https://api.github.com/repos/knbk/django/pulls{/number}","milestones_url":"https://api.github.com/repos/knbk/django/milestones{/number}","notifications_url":"https://api.github.com/repos/knbk/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knbk/django/labels{/name}","releases_url":"https://api.github.com/repos/knbk/django/releases{/id}","created_at":"2015-02-04T02:47:39Z","updated_at":"2015-03-29T11:24:39Z","pushed_at":"2015-03-29T11:27:08Z","git_url":"git://github.com/knbk/django.git","ssh_url":"git@github.com:knbk/django.git","clone_url":"https://github.com/knbk/django.git","svn_url":"https://github.com/knbk/django","homepage":"https://www.djangoproject.com/","size":126368,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"django:master","ref":"master","sha":"c7ec3c07e78e288a48e87b979dbd12e1fa44fe66","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","created_at":"2012-04-28T02:47:18Z","updated_at":"2015-03-29T11:18:21Z","pushed_at":"2015-03-29T11:27:13Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":274972,"stargazers_count":13540,"watchers_count":13540,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5325,"mirror_url":null,"open_issues_count":67,"forks":5325,"open_issues":67,"watchers":13540,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/4312"},"html":{"href":"https://github.com/django/django/pull/4312"},"issue":{"href":"https://api.github.com/repos/django/django/issues/4312"},"comments":{"href":"https://api.github.com/repos/django/django/issues/4312/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/4312/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/4312/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/0f38b067a98a2a05c9f173566a0c0bfcc04e90c1"}}}}