{"action":"created","comment":{"url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/comments/44949071","id":44949071,"diff_hunk":"@@ -37,6 +37,32 @@ Create an Enum-class and pass it as first argument to the Django model EnumField\n     class Beer(models.Model):\n         style = enum.EnumField(BeerStyle, default=BeerStyle.LAGER)\n \n+You can also set default value on your enum class using ``__default__``\n+attribute","path":"README.rst","position":5,"original_position":5,"commit_id":"c803abf90a36aebd05cb767735dde0ce3934e80f","original_commit_id":"c803abf90a36aebd05cb767735dde0ce3934e80f","user":{"login":"andreif","id":259691,"avatar_url":"https://avatars.githubusercontent.com/u/259691?v=3","gravatar_id":"","url":"https://api.github.com/users/andreif","html_url":"https://github.com/andreif","followers_url":"https://api.github.com/users/andreif/followers","following_url":"https://api.github.com/users/andreif/following{/other_user}","gists_url":"https://api.github.com/users/andreif/gists{/gist_id}","starred_url":"https://api.github.com/users/andreif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreif/subscriptions","organizations_url":"https://api.github.com/users/andreif/orgs","repos_url":"https://api.github.com/users/andreif/repos","events_url":"https://api.github.com/users/andreif/events{/privacy}","received_events_url":"https://api.github.com/users/andreif/received_events","type":"User","site_admin":false},"body":"Well, `Enum` itself has only one place to set default i.e. via `__default__` attribute. Previously, one would need to override `.default()` method (still possible) and it was not obvious/expected that the first value is the default one. One could restore the old behaviour by subclassing Enum whenever it's needed:\r\n\r\n```py\r\nfrom django_enumfield import enum\r\n\r\nclass FirstDefaultEnum(enum.Enum):\r\n    def default(cls):\r\n        return list(cls)[0]\r\n```\r\n\r\n`EnumField` on the other hand may be independent enough to override the default just if it's needed. For example, the same enum may be used in various places and who knows maybe someone will need to override the default just in one of them. I believe one expects this to be possible in a field.","created_at":"2015-11-16T16:52:39Z","updated_at":"2015-11-16T16:52:39Z","html_url":"https://github.com/fcurella/django-enumfield/pull/3#discussion_r44949071","pull_request_url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/comments/44949071"},"html":{"href":"https://github.com/fcurella/django-enumfield/pull/3#discussion_r44949071"},"pull_request":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3","id":50805792,"html_url":"https://github.com/fcurella/django-enumfield/pull/3","diff_url":"https://github.com/fcurella/django-enumfield/pull/3.diff","patch_url":"https://github.com/fcurella/django-enumfield/pull/3.patch","issue_url":"https://api.github.com/repos/fcurella/django-enumfield/issues/3","number":3,"state":"open","locked":false,"title":"Define default value explicitly via __default__ attribute","user":{"login":"andreif","id":259691,"avatar_url":"https://avatars.githubusercontent.com/u/259691?v=3","gravatar_id":"","url":"https://api.github.com/users/andreif","html_url":"https://github.com/andreif","followers_url":"https://api.github.com/users/andreif/followers","following_url":"https://api.github.com/users/andreif/following{/other_user}","gists_url":"https://api.github.com/users/andreif/gists{/gist_id}","starred_url":"https://api.github.com/users/andreif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreif/subscriptions","organizations_url":"https://api.github.com/users/andreif/orgs","repos_url":"https://api.github.com/users/andreif/repos","events_url":"https://api.github.com/users/andreif/events{/privacy}","received_events_url":"https://api.github.com/users/andreif/received_events","type":"User","site_admin":false},"body":"Related to 5monkeys/django-enumfield#25","created_at":"2015-11-16T12:45:48Z","updated_at":"2015-11-16T16:52:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d329aad048c939cd0581da337c12ca4b66b2ef5f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3/commits","review_comments_url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3/comments","review_comment_url":"https://api.github.com/repos/fcurella/django-enumfield/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fcurella/django-enumfield/issues/3/comments","statuses_url":"https://api.github.com/repos/fcurella/django-enumfield/statuses/c803abf90a36aebd05cb767735dde0ce3934e80f","head":{"label":"5monkeys:forks/fcurella/enum34","ref":"forks/fcurella/enum34","sha":"c803abf90a36aebd05cb767735dde0ce3934e80f","user":{"login":"5monkeys","id":1019061,"avatar_url":"https://avatars.githubusercontent.com/u/1019061?v=3","gravatar_id":"","url":"https://api.github.com/users/5monkeys","html_url":"https://github.com/5monkeys","followers_url":"https://api.github.com/users/5monkeys/followers","following_url":"https://api.github.com/users/5monkeys/following{/other_user}","gists_url":"https://api.github.com/users/5monkeys/gists{/gist_id}","starred_url":"https://api.github.com/users/5monkeys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/5monkeys/subscriptions","organizations_url":"https://api.github.com/users/5monkeys/orgs","repos_url":"https://api.github.com/users/5monkeys/repos","events_url":"https://api.github.com/users/5monkeys/events{/privacy}","received_events_url":"https://api.github.com/users/5monkeys/received_events","type":"Organization","site_admin":false},"repo":{"id":7934826,"name":"django-enumfield","full_name":"5monkeys/django-enumfield","owner":{"login":"5monkeys","id":1019061,"avatar_url":"https://avatars.githubusercontent.com/u/1019061?v=3","gravatar_id":"","url":"https://api.github.com/users/5monkeys","html_url":"https://github.com/5monkeys","followers_url":"https://api.github.com/users/5monkeys/followers","following_url":"https://api.github.com/users/5monkeys/following{/other_user}","gists_url":"https://api.github.com/users/5monkeys/gists{/gist_id}","starred_url":"https://api.github.com/users/5monkeys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/5monkeys/subscriptions","organizations_url":"https://api.github.com/users/5monkeys/orgs","repos_url":"https://api.github.com/users/5monkeys/repos","events_url":"https://api.github.com/users/5monkeys/events{/privacy}","received_events_url":"https://api.github.com/users/5monkeys/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/5monkeys/django-enumfield","description":"Custom Django field for using enumerations of named constants","fork":false,"url":"https://api.github.com/repos/5monkeys/django-enumfield","forks_url":"https://api.github.com/repos/5monkeys/django-enumfield/forks","keys_url":"https://api.github.com/repos/5monkeys/django-enumfield/keys{/key_id}","collaborators_url":"https://api.github.com/repos/5monkeys/django-enumfield/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/5monkeys/django-enumfield/teams","hooks_url":"https://api.github.com/repos/5monkeys/django-enumfield/hooks","issue_events_url":"https://api.github.com/repos/5monkeys/django-enumfield/issues/events{/number}","events_url":"https://api.github.com/repos/5monkeys/django-enumfield/events","assignees_url":"https://api.github.com/repos/5monkeys/django-enumfield/assignees{/user}","branches_url":"https://api.github.com/repos/5monkeys/django-enumfield/branches{/branch}","tags_url":"https://api.github.com/repos/5monkeys/django-enumfield/tags","blobs_url":"https://api.github.com/repos/5monkeys/django-enumfield/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/5monkeys/django-enumfield/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/5monkeys/django-enumfield/git/refs{/sha}","trees_url":"https://api.github.com/repos/5monkeys/django-enumfield/git/trees{/sha}","statuses_url":"https://api.github.com/repos/5monkeys/django-enumfield/statuses/{sha}","languages_url":"https://api.github.com/repos/5monkeys/django-enumfield/languages","stargazers_url":"https://api.github.com/repos/5monkeys/django-enumfield/stargazers","contributors_url":"https://api.github.com/repos/5monkeys/django-enumfield/contributors","subscribers_url":"https://api.github.com/repos/5monkeys/django-enumfield/subscribers","subscription_url":"https://api.github.com/repos/5monkeys/django-enumfield/subscription","commits_url":"https://api.github.com/repos/5monkeys/django-enumfield/commits{/sha}","git_commits_url":"https://api.github.com/repos/5monkeys/django-enumfield/git/commits{/sha}","comments_url":"https://api.github.com/repos/5monkeys/django-enumfield/comments{/number}","issue_comment_url":"https://api.github.com/repos/5monkeys/django-enumfield/issues/comments{/number}","contents_url":"https://api.github.com/repos/5monkeys/django-enumfield/contents/{+path}","compare_url":"https://api.github.com/repos/5monkeys/django-enumfield/compare/{base}...{head}","merges_url":"https://api.github.com/repos/5monkeys/django-enumfield/merges","archive_url":"https://api.github.com/repos/5monkeys/django-enumfield/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/5monkeys/django-enumfield/downloads","issues_url":"https://api.github.com/repos/5monkeys/django-enumfield/issues{/number}","pulls_url":"https://api.github.com/repos/5monkeys/django-enumfield/pulls{/number}","milestones_url":"https://api.github.com/repos/5monkeys/django-enumfield/milestones{/number}","notifications_url":"https://api.github.com/repos/5monkeys/django-enumfield/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/5monkeys/django-enumfield/labels{/name}","releases_url":"https://api.github.com/repos/5monkeys/django-enumfield/releases{/id}","created_at":"2013-01-31T10:34:44Z","updated_at":"2015-11-15T22:17:31Z","pushed_at":"2015-11-16T12:36:57Z","git_url":"git://github.com/5monkeys/django-enumfield.git","ssh_url":"git@github.com:5monkeys/django-enumfield.git","clone_url":"https://github.com/5monkeys/django-enumfield.git","svn_url":"https://github.com/5monkeys/django-enumfield","homepage":"","size":522,"stargazers_count":68,"watchers_count":68,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":5,"forks":19,"open_issues":5,"watchers":68,"default_branch":"master"}},"base":{"label":"fcurella:enum34","ref":"enum34","sha":"5ef407259e02c854823e0eea28c1b4a73fc2b226","user":{"login":"fcurella","id":89607,"avatar_url":"https://avatars.githubusercontent.com/u/89607?v=3","gravatar_id":"","url":"https://api.github.com/users/fcurella","html_url":"https://github.com/fcurella","followers_url":"https://api.github.com/users/fcurella/followers","following_url":"https://api.github.com/users/fcurella/following{/other_user}","gists_url":"https://api.github.com/users/fcurella/gists{/gist_id}","starred_url":"https://api.github.com/users/fcurella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcurella/subscriptions","organizations_url":"https://api.github.com/users/fcurella/orgs","repos_url":"https://api.github.com/users/fcurella/repos","events_url":"https://api.github.com/users/fcurella/events{/privacy}","received_events_url":"https://api.github.com/users/fcurella/received_events","type":"User","site_admin":false},"repo":{"id":41510608,"name":"django-enumfield","full_name":"fcurella/django-enumfield","owner":{"login":"fcurella","id":89607,"avatar_url":"https://avatars.githubusercontent.com/u/89607?v=3","gravatar_id":"","url":"https://api.github.com/users/fcurella","html_url":"https://github.com/fcurella","followers_url":"https://api.github.com/users/fcurella/followers","following_url":"https://api.github.com/users/fcurella/following{/other_user}","gists_url":"https://api.github.com/users/fcurella/gists{/gist_id}","starred_url":"https://api.github.com/users/fcurella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fcurella/subscriptions","organizations_url":"https://api.github.com/users/fcurella/orgs","repos_url":"https://api.github.com/users/fcurella/repos","events_url":"https://api.github.com/users/fcurella/events{/privacy}","received_events_url":"https://api.github.com/users/fcurella/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fcurella/django-enumfield","description":"Custom Django field for using enumerations of named constants","fork":true,"url":"https://api.github.com/repos/fcurella/django-enumfield","forks_url":"https://api.github.com/repos/fcurella/django-enumfield/forks","keys_url":"https://api.github.com/repos/fcurella/django-enumfield/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fcurella/django-enumfield/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fcurella/django-enumfield/teams","hooks_url":"https://api.github.com/repos/fcurella/django-enumfield/hooks","issue_events_url":"https://api.github.com/repos/fcurella/django-enumfield/issues/events{/number}","events_url":"https://api.github.com/repos/fcurella/django-enumfield/events","assignees_url":"https://api.github.com/repos/fcurella/django-enumfield/assignees{/user}","branches_url":"https://api.github.com/repos/fcurella/django-enumfield/branches{/branch}","tags_url":"https://api.github.com/repos/fcurella/django-enumfield/tags","blobs_url":"https://api.github.com/repos/fcurella/django-enumfield/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fcurella/django-enumfield/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fcurella/django-enumfield/git/refs{/sha}","trees_url":"https://api.github.com/repos/fcurella/django-enumfield/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fcurella/django-enumfield/statuses/{sha}","languages_url":"https://api.github.com/repos/fcurella/django-enumfield/languages","stargazers_url":"https://api.github.com/repos/fcurella/django-enumfield/stargazers","contributors_url":"https://api.github.com/repos/fcurella/django-enumfield/contributors","subscribers_url":"https://api.github.com/repos/fcurella/django-enumfield/subscribers","subscription_url":"https://api.github.com/repos/fcurella/django-enumfield/subscription","commits_url":"https://api.github.com/repos/fcurella/django-enumfield/commits{/sha}","git_commits_url":"https://api.github.com/repos/fcurella/django-enumfield/git/commits{/sha}","comments_url":"https://api.github.com/repos/fcurella/django-enumfield/comments{/number}","issue_comment_url":"https://api.github.com/repos/fcurella/django-enumfield/issues/comments{/number}","contents_url":"https://api.github.com/repos/fcurella/django-enumfield/contents/{+path}","compare_url":"https://api.github.com/repos/fcurella/django-enumfield/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fcurella/django-enumfield/merges","archive_url":"https://api.github.com/repos/fcurella/django-enumfield/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fcurella/django-enumfield/downloads","issues_url":"https://api.github.com/repos/fcurella/django-enumfield/issues{/number}","pulls_url":"https://api.github.com/repos/fcurella/django-enumfield/pulls{/number}","milestones_url":"https://api.github.com/repos/fcurella/django-enumfield/milestones{/number}","notifications_url":"https://api.github.com/repos/fcurella/django-enumfield/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fcurella/django-enumfield/labels{/name}","releases_url":"https://api.github.com/repos/fcurella/django-enumfield/releases{/id}","created_at":"2015-08-27T20:49:33Z","updated_at":"2015-09-29T16:33:08Z","pushed_at":"2015-11-16T12:45:48Z","git_url":"git://github.com/fcurella/django-enumfield.git","ssh_url":"git@github.com:fcurella/django-enumfield.git","clone_url":"https://github.com/fcurella/django-enumfield.git","svn_url":"https://github.com/fcurella/django-enumfield","homepage":"","size":253,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3"},"html":{"href":"https://github.com/fcurella/django-enumfield/pull/3"},"issue":{"href":"https://api.github.com/repos/fcurella/django-enumfield/issues/3"},"comments":{"href":"https://api.github.com/repos/fcurella/django-enumfield/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fcurella/django-enumfield/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/fcurella/django-enumfield/statuses/c803abf90a36aebd05cb767735dde0ce3934e80f"}}}}