{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/87645156","pull_request_review_id":8251670,"id":87645156,"diff_hunk":"@@ -82,10 +82,49 @@ def test_choicefield_disabled(self):\n         f = ChoiceField(choices=[('J', 'John'), ('P', 'Paul')], disabled=True)\n         self.assertWidgetRendersTo(\n             f,\n-            '<select id=\"id_f\" name=\"f\" disabled required><option value=\"J\">John</option>'\n+            '<select id=\"id_f\" name=\"f\" disabled><option value=\"J\">John</option>'\n             '<option value=\"P\">Paul</option></select>'\n         )\n \n+    def test_choicefield_doesnt_render_required_when_impossible_to_select_empty_field(self):\n+        f = ChoiceField(choices=[('J', 'John'), ('P', 'Paul')])\n+        self.assertWidgetRendersTo(\n+            f,\n+            '<select id=\"id_f\" name=\"f\"><option value=\"J\">John</option>'\n+            '<option value=\"P\">Paul</option></select>'\n+        )\n+\n+    def test_choicefield_does_render_required_when_possible_to_select_empty_field_str(self):\n+        f = ChoiceField(choices=[('', 'select please'), ('P', 'Paul')])\n+        self.assertWidgetRendersTo(\n+            f,\n+            '<select id=\"id_f\" name=\"f\" required><option selected value=\"\">select please</option>'\n+            '<option value=\"P\">Paul</option></select>'\n+        )\n+\n+    def test_choicefield_does_render_required_when_possible_to_select_empty_field_list(self):\n+        f = ChoiceField(choices=[['', 'select please'], ['P', 'Paul']])\n+        self.assertWidgetRendersTo(\n+            f,\n+            '<select id=\"id_f\" name=\"f\" required><option selected value=\"\">select please</option>'\n+            '<option value=\"P\">Paul</option></select>'\n+        )\n+\n+    def test_choicefield_does_render_required_when_possible_to_select_empty_field_none(self):\n+        f = ChoiceField(choices=[(None, 'select please'), ('P', 'Paul')])\n+        self.assertWidgetRendersTo(\n+            f,\n+            '<select id=\"id_f\" name=\"f\" required><option selected value=\"\">select please</option>'\n+            '<option value=\"P\">Paul</option></select>'\n+        )\n+\n+    def test_choicefield_doesnt_render_required_when_no_choices_are_available(self):\n+        f = ChoiceField(choices=[])\n+        self.assertWidgetRendersTo(","path":"tests/forms_tests/field_tests/test_choicefield.py","position":43,"original_position":43,"commit_id":"d85a92315c4d3cd19d3af66b1e30931bae521728","original_commit_id":"d85a92315c4d3cd19d3af66b1e30931bae521728","user":{"login":"timgraham","id":411869,"avatar_url":"https://avatars.githubusercontent.com/u/411869?v=3","gravatar_id":"","url":"https://api.github.com/users/timgraham","html_url":"https://github.com/timgraham","followers_url":"https://api.github.com/users/timgraham/followers","following_url":"https://api.github.com/users/timgraham/following{/other_user}","gists_url":"https://api.github.com/users/timgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/timgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgraham/subscriptions","organizations_url":"https://api.github.com/users/timgraham/orgs","repos_url":"https://api.github.com/users/timgraham/repos","events_url":"https://api.github.com/users/timgraham/events{/privacy}","received_events_url":"https://api.github.com/users/timgraham/received_events","type":"User","site_admin":false},"body":"I'd use a single line here since it'll fit.","created_at":"2016-11-11T19:32:42Z","updated_at":"2016-11-11T19:34:12Z","html_url":"https://github.com/django/django/pull/7497#discussion_r87645156","pull_request_url":"https://api.github.com/repos/django/django/pulls/7497","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/87645156"},"html":{"href":"https://github.com/django/django/pull/7497#discussion_r87645156"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/7497"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/7497","id":92455830,"html_url":"https://github.com/django/django/pull/7497","diff_url":"https://github.com/django/django/pull/7497.diff","patch_url":"https://github.com/django/django/pull/7497.patch","issue_url":"https://api.github.com/repos/django/django/issues/7497","number":7497,"state":"open","locked":false,"title":"Fixed #27370 -- Fixed select HTML validator issue","user":{"login":"stlk","id":450975,"avatar_url":"https://avatars.githubusercontent.com/u/450975?v=3","gravatar_id":"","url":"https://api.github.com/users/stlk","html_url":"https://github.com/stlk","followers_url":"https://api.github.com/users/stlk/followers","following_url":"https://api.github.com/users/stlk/following{/other_user}","gists_url":"https://api.github.com/users/stlk/gists{/gist_id}","starred_url":"https://api.github.com/users/stlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stlk/subscriptions","organizations_url":"https://api.github.com/users/stlk/orgs","repos_url":"https://api.github.com/users/stlk/repos","events_url":"https://api.github.com/users/stlk/events{/privacy}","received_events_url":"https://api.github.com/users/stlk/received_events","type":"User","site_admin":false},"body":"Fixed issue where we caused HTML to be invalid by specifying required\r\non select field with nonempty first value.\r\n\r\nhttps://github.com/validator/validator/issues/47","created_at":"2016-11-05T14:56:26Z","updated_at":"2016-11-11T19:34:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc249358d25652890bdf10fb911752c74b2f039f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/7497/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/7497/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/7497/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/d85a92315c4d3cd19d3af66b1e30931bae521728","head":{"label":"stlk:ticket_27370","ref":"ticket_27370","sha":"d85a92315c4d3cd19d3af66b1e30931bae521728","user":{"login":"stlk","id":450975,"avatar_url":"https://avatars.githubusercontent.com/u/450975?v=3","gravatar_id":"","url":"https://api.github.com/users/stlk","html_url":"https://github.com/stlk","followers_url":"https://api.github.com/users/stlk/followers","following_url":"https://api.github.com/users/stlk/following{/other_user}","gists_url":"https://api.github.com/users/stlk/gists{/gist_id}","starred_url":"https://api.github.com/users/stlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stlk/subscriptions","organizations_url":"https://api.github.com/users/stlk/orgs","repos_url":"https://api.github.com/users/stlk/repos","events_url":"https://api.github.com/users/stlk/events{/privacy}","received_events_url":"https://api.github.com/users/stlk/received_events","type":"User","site_admin":false},"repo":{"id":72916240,"name":"django","full_name":"stlk/django","owner":{"login":"stlk","id":450975,"avatar_url":"https://avatars.githubusercontent.com/u/450975?v=3","gravatar_id":"","url":"https://api.github.com/users/stlk","html_url":"https://github.com/stlk","followers_url":"https://api.github.com/users/stlk/followers","following_url":"https://api.github.com/users/stlk/following{/other_user}","gists_url":"https://api.github.com/users/stlk/gists{/gist_id}","starred_url":"https://api.github.com/users/stlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stlk/subscriptions","organizations_url":"https://api.github.com/users/stlk/orgs","repos_url":"https://api.github.com/users/stlk/repos","events_url":"https://api.github.com/users/stlk/events{/privacy}","received_events_url":"https://api.github.com/users/stlk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stlk/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/stlk/django","forks_url":"https://api.github.com/repos/stlk/django/forks","keys_url":"https://api.github.com/repos/stlk/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stlk/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stlk/django/teams","hooks_url":"https://api.github.com/repos/stlk/django/hooks","issue_events_url":"https://api.github.com/repos/stlk/django/issues/events{/number}","events_url":"https://api.github.com/repos/stlk/django/events","assignees_url":"https://api.github.com/repos/stlk/django/assignees{/user}","branches_url":"https://api.github.com/repos/stlk/django/branches{/branch}","tags_url":"https://api.github.com/repos/stlk/django/tags","blobs_url":"https://api.github.com/repos/stlk/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stlk/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stlk/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/stlk/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stlk/django/statuses/{sha}","languages_url":"https://api.github.com/repos/stlk/django/languages","stargazers_url":"https://api.github.com/repos/stlk/django/stargazers","contributors_url":"https://api.github.com/repos/stlk/django/contributors","subscribers_url":"https://api.github.com/repos/stlk/django/subscribers","subscription_url":"https://api.github.com/repos/stlk/django/subscription","commits_url":"https://api.github.com/repos/stlk/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/stlk/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/stlk/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/stlk/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/stlk/django/contents/{+path}","compare_url":"https://api.github.com/repos/stlk/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stlk/django/merges","archive_url":"https://api.github.com/repos/stlk/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stlk/django/downloads","issues_url":"https://api.github.com/repos/stlk/django/issues{/number}","pulls_url":"https://api.github.com/repos/stlk/django/pulls{/number}","milestones_url":"https://api.github.com/repos/stlk/django/milestones{/number}","notifications_url":"https://api.github.com/repos/stlk/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stlk/django/labels{/name}","releases_url":"https://api.github.com/repos/stlk/django/releases{/id}","deployments_url":"https://api.github.com/repos/stlk/django/deployments","created_at":"2016-11-05T09:20:36Z","updated_at":"2016-11-05T09:20:57Z","pushed_at":"2016-11-11T14:31:44Z","git_url":"git://github.com/stlk/django.git","ssh_url":"git@github.com:stlk/django.git","clone_url":"https://github.com/stlk/django.git","svn_url":"https://github.com/stlk/django","homepage":"https://www.djangoproject.com/","size":151547,"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":"1446902be48ebf19bfe484371897a2815dd21fca","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}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-11-11T19:15:56Z","pushed_at":"2016-11-11T18:05: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":215188,"stargazers_count":22098,"watchers_count":22098,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8890,"mirror_url":null,"open_issues_count":125,"forks":8890,"open_issues":125,"watchers":22098,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/7497"},"html":{"href":"https://github.com/django/django/pull/7497"},"issue":{"href":"https://api.github.com/repos/django/django/issues/7497"},"comments":{"href":"https://api.github.com/repos/django/django/issues/7497/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/7497/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/7497/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/d85a92315c4d3cd19d3af66b1e30931bae521728"}}}}
{"actor":{"display_login":"timgraham"}}