{"action":"opened","number":18557,"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/18557","id":200677751,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNjc3NzUx","html_url":"https://github.com/edx/edx-platform/pull/18557","diff_url":"https://github.com/edx/edx-platform/pull/18557.diff","patch_url":"https://github.com/edx/edx-platform/pull/18557.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/18557","number":18557,"state":"open","locked":false,"title":"OSPR: Improve Course Modes configuration","user":{"login":"mreyk","id":11334168,"node_id":"MDQ6VXNlcjExMzM0MTY4","avatar_url":"https://avatars3.githubusercontent.com/u/11334168?v=4","gravatar_id":"","url":"https://api.github.com/users/mreyk","html_url":"https://github.com/mreyk","followers_url":"https://api.github.com/users/mreyk/followers","following_url":"https://api.github.com/users/mreyk/following{/other_user}","gists_url":"https://api.github.com/users/mreyk/gists{/gist_id}","starred_url":"https://api.github.com/users/mreyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mreyk/subscriptions","organizations_url":"https://api.github.com/users/mreyk/orgs","repos_url":"https://api.github.com/users/mreyk/repos","events_url":"https://api.github.com/users/mreyk/events{/privacy}","received_events_url":"https://api.github.com/users/mreyk/received_events","type":"User","site_admin":false},"body":"This PR adds more configurable fields to the `COURSE_ENROLLMENT_MODES` variable defined in `lms/envs/comon.py`. It keeps already defined integer values as `id`.\r\n\r\n* Before:\r\n```\r\nCOURSE_ENROLLMENT_MODES = {\r\n    \"audit\": 1,\r\n    \"verified\": 2,\r\n    \"professional\": 3,\r\n    \"no-id-professional\": 4,\r\n    \"credit\": 5,\r\n    \"honor\": 6,\r\n}\r\n```\r\n* After:\r\n```\r\nCOURSE_ENROLLMENT_MODES = {\r\n    \"audit\": {\"id\": 1, \"slug\": \"audit\", \"display_name\": _(\"Audit\"), \"min_price\": 0},\r\n    \"verified\": {\"id\": 2, \"slug\": \"verified\", \"display_name\": _(\"Verified\"), \"min_price\": 0},\r\n    \"professional\": {\"id\": 3, \"slug\": \"professional\", \"display_name\": _(\"Professional\"), \"min_price\": 0},\r\n    \"no-id-professional\": {\"id\": 4, \"slug\": \"no-id-professional\", \"display_name\": _(\"No-Id-Professional\"), \"min_price\": 0},\r\n    \"credit\": {\"id\": 5, \"slug\": \"credit\", \"display_name\": _(\"Credit\"), \"min_price\": 0},\r\n    \"honor\": {\"id\": 6, \"slug\": \"honor\", \"display_name\": _(\"Honor\"), \"min_price\": 0},\r\n }\r\n```\r\nOne of the uses of this feature is to show a more friendly name in Django admin panel when creating a new Course Mode.\r\n\r\nI've added the option to override the default values in `lms/envs/aws.py`. For example, in case we don't want admin users to create other than audit and honor course modes, we just need to add to the `server-vars.yml` file:\r\n```\r\nEDXAPP_ENV_EXTRA:\r\n  COURSE_ENROLLMENT_MODES:\r\n    audit:\r\n      id: 1\r\n      slug: \"audit\"\r\n      display_name: \"Gratuito\"\r\n      min_price: 0\r\n    honor:\r\n      id: 2\r\n      slug: \"honor\"\r\n      display_name: \"Credencial\"\r\n      min_price: 15\r\n```\r\nAnd update configuration and edx-platform.\r\nTo test it, go to django admin panel and try to create a new course mode. In the mode slug section, you should only see the options defined in the `COURSE_ENROLLMENT_MODES` variable.\r\n","created_at":"2018-07-11T12:05:41Z","updated_at":"2018-07-11T12:05:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/18557/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/18557/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/18557/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/7c7ab297eb2f336ba81ca008dd0ceca87e2d9574","head":{"label":"mreyk:teltek/feature/improve-course-modes-configuration","ref":"teltek/feature/improve-course-modes-configuration","sha":"7c7ab297eb2f336ba81ca008dd0ceca87e2d9574","user":{"login":"mreyk","id":11334168,"node_id":"MDQ6VXNlcjExMzM0MTY4","avatar_url":"https://avatars3.githubusercontent.com/u/11334168?v=4","gravatar_id":"","url":"https://api.github.com/users/mreyk","html_url":"https://github.com/mreyk","followers_url":"https://api.github.com/users/mreyk/followers","following_url":"https://api.github.com/users/mreyk/following{/other_user}","gists_url":"https://api.github.com/users/mreyk/gists{/gist_id}","starred_url":"https://api.github.com/users/mreyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mreyk/subscriptions","organizations_url":"https://api.github.com/users/mreyk/orgs","repos_url":"https://api.github.com/users/mreyk/repos","events_url":"https://api.github.com/users/mreyk/events{/privacy}","received_events_url":"https://api.github.com/users/mreyk/received_events","type":"User","site_admin":false},"repo":{"id":55056216,"node_id":"MDEwOlJlcG9zaXRvcnk1NTA1NjIxNg==","name":"edx-platform","full_name":"mreyk/edx-platform","owner":{"login":"mreyk","id":11334168,"node_id":"MDQ6VXNlcjExMzM0MTY4","avatar_url":"https://avatars3.githubusercontent.com/u/11334168?v=4","gravatar_id":"","url":"https://api.github.com/users/mreyk","html_url":"https://github.com/mreyk","followers_url":"https://api.github.com/users/mreyk/followers","following_url":"https://api.github.com/users/mreyk/following{/other_user}","gists_url":"https://api.github.com/users/mreyk/gists{/gist_id}","starred_url":"https://api.github.com/users/mreyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mreyk/subscriptions","organizations_url":"https://api.github.com/users/mreyk/orgs","repos_url":"https://api.github.com/users/mreyk/repos","events_url":"https://api.github.com/users/mreyk/events{/privacy}","received_events_url":"https://api.github.com/users/mreyk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mreyk/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":true,"url":"https://api.github.com/repos/mreyk/edx-platform","forks_url":"https://api.github.com/repos/mreyk/edx-platform/forks","keys_url":"https://api.github.com/repos/mreyk/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mreyk/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mreyk/edx-platform/teams","hooks_url":"https://api.github.com/repos/mreyk/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/mreyk/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/mreyk/edx-platform/events","assignees_url":"https://api.github.com/repos/mreyk/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/mreyk/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/mreyk/edx-platform/tags","blobs_url":"https://api.github.com/repos/mreyk/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mreyk/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mreyk/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mreyk/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mreyk/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mreyk/edx-platform/languages","stargazers_url":"https://api.github.com/repos/mreyk/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/mreyk/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/mreyk/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/mreyk/edx-platform/subscription","commits_url":"https://api.github.com/repos/mreyk/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mreyk/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mreyk/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mreyk/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mreyk/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/mreyk/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mreyk/edx-platform/merges","archive_url":"https://api.github.com/repos/mreyk/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mreyk/edx-platform/downloads","issues_url":"https://api.github.com/repos/mreyk/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/mreyk/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mreyk/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mreyk/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mreyk/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/mreyk/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/mreyk/edx-platform/deployments","created_at":"2016-03-30T11:03:53Z","updated_at":"2018-07-11T10:05:13Z","pushed_at":"2018-07-11T11:31:30Z","git_url":"git://github.com/mreyk/edx-platform.git","ssh_url":"git@github.com:mreyk/edx-platform.git","clone_url":"https://github.com/mreyk/edx-platform.git","svn_url":"https://github.com/mreyk/edx-platform","homepage":"http://open.edx.org/","size":929448,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"812f2754363d0dea8e4647154178085517df5d82","user":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"node_id":"MDEwOlJlcG9zaXRvcnkxMDM5MTA3Mw==","name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2018-07-11T12:04:47Z","pushed_at":"2018-07-11T12:04:04Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":944929,"stargazers_count":3763,"watchers_count":3763,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2122,"mirror_url":null,"archived":false,"open_issues_count":200,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":2122,"open_issues":200,"watchers":3763,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/18557"},"html":{"href":"https://github.com/edx/edx-platform/pull/18557"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/18557"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/18557/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/18557/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/18557/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/7c7ab297eb2f336ba81ca008dd0ceca87e2d9574"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":20,"deletions":14,"changed_files":8}}
{"actor":{"display_login":"mreyk"}}