{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/31745049","id":31745049,"diff_hunk":"@@ -279,6 +279,13 @@ def __new__(mcs, name, bases, attrs):\n                 # fields from the model\"\n                 opts.fields = None\n \n+            if opts.exclude:","path":"django/forms/models.py","position":4,"original_position":4,"commit_id":"c461b6f80e2b12ea6263ce63d12c6cf1202c1166","original_commit_id":"c461b6f80e2b12ea6263ce63d12c6cf1202c1166","user":{"login":"dgouldin","id":55577,"avatar_url":"https://avatars.githubusercontent.com/u/55577?v=3","gravatar_id":"","url":"https://api.github.com/users/dgouldin","html_url":"https://github.com/dgouldin","followers_url":"https://api.github.com/users/dgouldin/followers","following_url":"https://api.github.com/users/dgouldin/following{/other_user}","gists_url":"https://api.github.com/users/dgouldin/gists{/gist_id}","starred_url":"https://api.github.com/users/dgouldin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgouldin/subscriptions","organizations_url":"https://api.github.com/users/dgouldin/orgs","repos_url":"https://api.github.com/users/dgouldin/repos","events_url":"https://api.github.com/users/dgouldin/events{/privacy}","received_events_url":"https://api.github.com/users/dgouldin/received_events","type":"User","site_admin":false},"body":"Alternatively, you could handle this where `fields` is updated with `new_class.declared fields` like so:\r\n\r\n```\r\nfor field_name, field in new_class.declared_fields.iteritems():\r\n    if opts.exclude and field_name in opts.exclude:\r\n        continue\r\n    if opts.fields and field_name not in opts.fields:\r\n        continue\r\n    fields[field_name] = field\r\n```","created_at":"2015-06-04T17:43:12Z","updated_at":"2015-06-04T17:43:12Z","html_url":"https://github.com/django/django/pull/4747#discussion_r31745049","pull_request_url":"https://api.github.com/repos/django/django/pulls/4747","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/31745049"},"html":{"href":"https://github.com/django/django/pull/4747#discussion_r31745049"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/4747"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/4747","id":36913413,"html_url":"https://github.com/django/django/pull/4747","diff_url":"https://github.com/django/django/pull/4747.diff","patch_url":"https://github.com/django/django/pull/4747.patch","issue_url":"https://api.github.com/repos/django/django/issues/4747","number":4747,"state":"open","locked":false,"title":"Fixed #24908: exclude wouldn't apply on inherited form fields.","user":{"login":"jpic","id":94636,"avatar_url":"https://avatars.githubusercontent.com/u/94636?v=3","gravatar_id":"","url":"https://api.github.com/users/jpic","html_url":"https://github.com/jpic","followers_url":"https://api.github.com/users/jpic/followers","following_url":"https://api.github.com/users/jpic/following{/other_user}","gists_url":"https://api.github.com/users/jpic/gists{/gist_id}","starred_url":"https://api.github.com/users/jpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpic/subscriptions","organizations_url":"https://api.github.com/users/jpic/orgs","repos_url":"https://api.github.com/users/jpic/repos","events_url":"https://api.github.com/users/jpic/events{/privacy}","received_events_url":"https://api.github.com/users/jpic/received_events","type":"User","site_admin":false},"body":"If a ModelForm overrides a form field which would have been\r\nautomatically instanciated for a form field, then extending that model\r\nform with this field in Meta.exclude should indeed exclude that field.\r\n\r\nAt this point, the test fails and the excluded field ends up in\r\nbase_fields.","created_at":"2015-06-04T08:43:50Z","updated_at":"2015-06-04T17:43:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa18a26d4961ad5a49ccdd1312e450c453ddbe21","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/4747/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/4747/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/4747/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/c461b6f80e2b12ea6263ce63d12c6cf1202c1166","head":{"label":"jpic:fix/exclude_overridden_field","ref":"fix/exclude_overridden_field","sha":"c461b6f80e2b12ea6263ce63d12c6cf1202c1166","user":{"login":"jpic","id":94636,"avatar_url":"https://avatars.githubusercontent.com/u/94636?v=3","gravatar_id":"","url":"https://api.github.com/users/jpic","html_url":"https://github.com/jpic","followers_url":"https://api.github.com/users/jpic/followers","following_url":"https://api.github.com/users/jpic/following{/other_user}","gists_url":"https://api.github.com/users/jpic/gists{/gist_id}","starred_url":"https://api.github.com/users/jpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpic/subscriptions","organizations_url":"https://api.github.com/users/jpic/orgs","repos_url":"https://api.github.com/users/jpic/repos","events_url":"https://api.github.com/users/jpic/events{/privacy}","received_events_url":"https://api.github.com/users/jpic/received_events","type":"User","site_admin":false},"repo":{"id":36858667,"name":"django","full_name":"jpic/django","owner":{"login":"jpic","id":94636,"avatar_url":"https://avatars.githubusercontent.com/u/94636?v=3","gravatar_id":"","url":"https://api.github.com/users/jpic","html_url":"https://github.com/jpic","followers_url":"https://api.github.com/users/jpic/followers","following_url":"https://api.github.com/users/jpic/following{/other_user}","gists_url":"https://api.github.com/users/jpic/gists{/gist_id}","starred_url":"https://api.github.com/users/jpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpic/subscriptions","organizations_url":"https://api.github.com/users/jpic/orgs","repos_url":"https://api.github.com/users/jpic/repos","events_url":"https://api.github.com/users/jpic/events{/privacy}","received_events_url":"https://api.github.com/users/jpic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jpic/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/jpic/django","forks_url":"https://api.github.com/repos/jpic/django/forks","keys_url":"https://api.github.com/repos/jpic/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jpic/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jpic/django/teams","hooks_url":"https://api.github.com/repos/jpic/django/hooks","issue_events_url":"https://api.github.com/repos/jpic/django/issues/events{/number}","events_url":"https://api.github.com/repos/jpic/django/events","assignees_url":"https://api.github.com/repos/jpic/django/assignees{/user}","branches_url":"https://api.github.com/repos/jpic/django/branches{/branch}","tags_url":"https://api.github.com/repos/jpic/django/tags","blobs_url":"https://api.github.com/repos/jpic/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jpic/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jpic/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/jpic/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jpic/django/statuses/{sha}","languages_url":"https://api.github.com/repos/jpic/django/languages","stargazers_url":"https://api.github.com/repos/jpic/django/stargazers","contributors_url":"https://api.github.com/repos/jpic/django/contributors","subscribers_url":"https://api.github.com/repos/jpic/django/subscribers","subscription_url":"https://api.github.com/repos/jpic/django/subscription","commits_url":"https://api.github.com/repos/jpic/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/jpic/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/jpic/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/jpic/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/jpic/django/contents/{+path}","compare_url":"https://api.github.com/repos/jpic/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jpic/django/merges","archive_url":"https://api.github.com/repos/jpic/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jpic/django/downloads","issues_url":"https://api.github.com/repos/jpic/django/issues{/number}","pulls_url":"https://api.github.com/repos/jpic/django/pulls{/number}","milestones_url":"https://api.github.com/repos/jpic/django/milestones{/number}","notifications_url":"https://api.github.com/repos/jpic/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jpic/django/labels{/name}","releases_url":"https://api.github.com/repos/jpic/django/releases{/id}","created_at":"2015-06-04T08:42:11Z","updated_at":"2015-06-04T08:42:25Z","pushed_at":"2015-06-04T14:40:18Z","git_url":"git://github.com/jpic/django.git","ssh_url":"git@github.com:jpic/django.git","clone_url":"https://github.com/jpic/django.git","svn_url":"https://github.com/jpic/django","homepage":"https://www.djangoproject.com/","size":140296,"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:stable/1.8.x","ref":"stable/1.8.x","sha":"2358c1e5d771ab09ec555ffc8c3c46d56507293e","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-06-04T17:31:12Z","pushed_at":"2015-06-04T17:40:45Z","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":306686,"stargazers_count":14500,"watchers_count":14500,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5794,"mirror_url":null,"open_issues_count":92,"forks":5794,"open_issues":92,"watchers":14500,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/4747"},"html":{"href":"https://github.com/django/django/pull/4747"},"issue":{"href":"https://api.github.com/repos/django/django/issues/4747"},"comments":{"href":"https://api.github.com/repos/django/django/issues/4747/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/4747/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/4747/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/c461b6f80e2b12ea6263ce63d12c6cf1202c1166"}}}}