diff --git a/cms/djangoapps/contentstore/views/tests/test_item.py b/cms/djangoapps/contentstore/views/tests/test_item.py index fb9c5503425a86fef7c8b6021ddfca1059416a19..b8d0e9db7bd367913832de9e27412c3194bc336a 100644 --- a/cms/djangoapps/contentstore/views/tests/test_item.py +++ b/cms/djangoapps/contentstore/views/tests/test_item.py @@ -384,7 +384,7 @@ class GetItemTest(ItemTest): "scheme": "enrollment_track", "groups": [ { - "id": settings.COURSE_ENROLLMENT_MODES["audit"], + "id": settings.COURSE_ENROLLMENT_MODES["audit"]["id"], "name": "Audit", "selected": False, "deleted": False, diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 6eb168ee60b4ad20fb562a3729ec15f8b06bed3c..fa3c8b1d274ef4bc4ac589746721f6b64f2f88f6 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -594,6 +594,9 @@ RETIREMENT_SERVICE_WORKER_USERNAME = ENV_TOKENS.get( ) RETIREMENT_STATES = ENV_TOKENS.get('RETIREMENT_STATES', RETIREMENT_STATES) +############## Settings for Course Enrollment Modes ###################### +COURSE_ENROLLMENT_MODES = ENV_TOKENS.get('COURSE_ENROLLMENT_MODES', COURSE_ENROLLMENT_MODES) + ####################### Plugin Settings ########################## from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants diff --git a/common/djangoapps/course_modes/admin.py b/common/djangoapps/course_modes/admin.py index 6687f35d660759ac07d66e6d50e8dd9b6301e4d3..0181c0c50b752d76b73b6d390bdae334eaea461c 100644 --- a/common/djangoapps/course_modes/admin.py +++ b/common/djangoapps/course_modes/admin.py @@ -1,3 +1,4 @@ +import six from django import forms from django.conf import settings from django.contrib import admin @@ -23,7 +24,7 @@ from openedx.core.lib.courses import clean_course_id from util.date_utils import get_time_display from xmodule.modulestore.django import modulestore -COURSE_MODE_SLUG_CHOICES = [(mode_slug, mode_slug) for mode_slug in settings.COURSE_ENROLLMENT_MODES] +COURSE_MODE_SLUG_CHOICES = [(key, enrollment_mode['display_name']) for key, enrollment_mode in six.iteritems(settings.COURSE_ENROLLMENT_MODES)] class CourseModeForm(forms.ModelForm): diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 06282d3bc0d473dc8fe3bdd85cf9f15ba03efe71..53d7a5e4331e5071a610f89d89dcf80963400e89 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -1093,6 +1093,9 @@ RETIREMENT_SERVICE_WORKER_USERNAME = ENV_TOKENS.get( ) RETIREMENT_STATES = ENV_TOKENS.get('RETIREMENT_STATES', RETIREMENT_STATES) +############## Settings for Course Enrollment Modes ###################### +COURSE_ENROLLMENT_MODES = ENV_TOKENS.get('COURSE_ENROLLMENT_MODES', COURSE_ENROLLMENT_MODES) + ############################### Plugin Settings ############################### from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants diff --git a/lms/envs/common.py b/lms/envs/common.py index 73caf09ce0e538868a06b38b8848c4325648b3af..6396ba019465b8d128af62a33c14e5eff0c71bc9 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -3361,12 +3361,42 @@ BASE_COOKIE_DOMAIN = 'localhost' ############## Settings for Course Enrollment Modes ###################### COURSE_ENROLLMENT_MODES = { - "audit": 1, - "verified": 2, - "professional": 3, - "no-id-professional": 4, - "credit": 5, - "honor": 6, + "audit": { + "id": 1, + "slug": "audit", + "display_name": _("Audit"), + "min_price": 0 + }, + "verified": { + "id": 2, + "slug": "verified", + "display_name": _("Verified"), + "min_price": 0 + }, + "professional": { + "id": 3, + "slug": "professional", + "display_name": _("Professional"), + "min_price": 0 + }, + "no-id-professional": { + "id": 4, + "slug": "no-id-professional", + "display_name": _("No-Id-Professional"), + "min_price": 0 + }, + "credit": { + "id": 5, + "slug": "credit", + "display_name": _("Credit"), + "min_price": 0 + }, + "honor": { + "id": 6, + "slug": "honor", + "display_name": _("Honor"), + "min_price": 0 + }, } ############## Settings for the Discovery App ###################### diff --git a/openedx/core/djangoapps/verified_track_content/management/commands/swap_from_auto_track_cohort_pilot.py b/openedx/core/djangoapps/verified_track_content/management/commands/swap_from_auto_track_cohort_pilot.py index fcd50bd558e179a4c0a9b4f28b255bd93c6544a0..63a09eed698dbe4af527c470f5103063c3527840 100644 --- a/openedx/core/djangoapps/verified_track_content/management/commands/swap_from_auto_track_cohort_pilot.py +++ b/openedx/core/djangoapps/verified_track_content/management/commands/swap_from_auto_track_cohort_pilot.py @@ -197,9 +197,9 @@ class Command(BaseCommand): # Add the enrollment track ids to a group access array enrollment_track_group_access = [] if set_audit_enrollment_track: - enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['audit']) + enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['audit']['id']) if set_verified_enrollment_track: - enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['verified']) + enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['verified']['id']) # If there are no errors, and either the audit track, or verified # track needed an update, set the access, update and publish diff --git a/openedx/core/djangoapps/verified_track_content/partition_scheme.py b/openedx/core/djangoapps/verified_track_content/partition_scheme.py index 33f37303bb2b3e3e399de67924c462dd1fd353e8..cc87622e4ad6bd0075d0ea5454a9f15e4483ee5a 100644 --- a/openedx/core/djangoapps/verified_track_content/partition_scheme.py +++ b/openedx/core/djangoapps/verified_track_content/partition_scheme.py @@ -45,7 +45,7 @@ class EnrollmentTrackUserPartition(UserPartition): return [] return [ - Group(ENROLLMENT_GROUP_IDS[mode.slug], unicode(mode.name)) + Group(ENROLLMENT_GROUP_IDS[mode.slug]["id"], unicode(mode.name)) for mode in CourseMode.modes_for_course(course_key, include_expired=True) ] @@ -100,7 +100,7 @@ class EnrollmentTrackPartitionScheme(object): course_mode = CourseMode.verified_mode_for_course(course_key, include_expired=True) if not course_mode: course_mode = CourseMode.DEFAULT_MODE - return Group(ENROLLMENT_GROUP_IDS[course_mode.slug], unicode(course_mode.name)) + return Group(ENROLLMENT_GROUP_IDS[course_mode.slug]["id"], unicode(course_mode.name)) else: return None diff --git a/openedx/core/djangoapps/verified_track_content/tests/test_partition_scheme.py b/openedx/core/djangoapps/verified_track_content/tests/test_partition_scheme.py index c45716774eeb44f70af019b2d12fcf4341124bc6..a1062b6c7c3b7985d6e4f3b0f20d28c55a136a81 100644 --- a/openedx/core/djangoapps/verified_track_content/tests/test_partition_scheme.py +++ b/openedx/core/djangoapps/verified_track_content/tests/test_partition_scheme.py @@ -69,7 +69,7 @@ class EnrollmentTrackUserPartitionTest(SharedModuleStoreTestCase): with group IDs associated with cohort and random user partitions). """ for mode in ENROLLMENT_GROUP_IDS: - self.assertLess(ENROLLMENT_GROUP_IDS[mode], MINIMUM_STATIC_PARTITION_ID) + self.assertLess(ENROLLMENT_GROUP_IDS[mode]['id'], MINIMUM_STATIC_PARTITION_ID) @staticmethod def get_group_by_name(partition, name):