diff --git a/cms/envs/common.py b/cms/envs/common.py index 84d171c8d9ba1136dff67fb6bbb584aa3a026f44..cbe0543cf5d831b785c4dbf4043ee384ee8846eb 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -59,7 +59,7 @@ from lms.envs.common import ( # The following setting is included as it is used to check whether to # display credit eligibility table on the CMS or not. ENABLE_CREDIT_ELIGIBILITY, YOUTUBE_API_KEY, - DEFAULT_COURSE_ABOUT_IMAGE_URL, + COURSE_MODE_DEFAULTS, DEFAULT_COURSE_ABOUT_IMAGE_URL, # Django REST framework configuration REST_FRAMEWORK, diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index 37df4c707bebce84f55e59a9536339065412a9aa..55c62c177e51c769365e421b9744487e59cf7837 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -6,6 +6,7 @@ from datetime import datetime, timedelta import pytz from config_models.models import ConfigurationModel +from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q @@ -119,8 +120,18 @@ class CourseMode(models.Model): NO_ID_PROFESSIONAL_MODE = "no-id-professional" CREDIT_MODE = "credit" - DEFAULT_MODE = Mode(AUDIT, _('Audit'), 0, '', 'usd', None, None, None, None) - DEFAULT_MODE_SLUG = AUDIT + DEFAULT_MODE = Mode( + settings.COURSE_MODE_DEFAULTS['slug'], + settings.COURSE_MODE_DEFAULTS['name'], + settings.COURSE_MODE_DEFAULTS['min_price'], + settings.COURSE_MODE_DEFAULTS['suggested_prices'], + settings.COURSE_MODE_DEFAULTS['currency'], + settings.COURSE_MODE_DEFAULTS['expiration_datetime'], + settings.COURSE_MODE_DEFAULTS['description'], + settings.COURSE_MODE_DEFAULTS['sku'], + settings.COURSE_MODE_DEFAULTS['bulk_sku'], + ) + DEFAULT_MODE_SLUG = settings.COURSE_MODE_DEFAULTS['slug'] # Modes utilized for audit/free enrollments AUDIT_MODES = [AUDIT, HONOR] diff --git a/lms/envs/aws.py b/lms/envs/aws.py index ad4018200d868c7066ac63b91ba00b49d34201da..d120f4320900a42925a6667e9f2c8e23d8a9cde6 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -137,6 +137,9 @@ if STATIC_URL_BASE: # DEFAULT_COURSE_ABOUT_IMAGE_URL specifies the default image to show for courses that don't provide one DEFAULT_COURSE_ABOUT_IMAGE_URL = ENV_TOKENS.get('DEFAULT_COURSE_ABOUT_IMAGE_URL', DEFAULT_COURSE_ABOUT_IMAGE_URL) +# COURSE_MODE_DEFAULTS specifies the course mode to use for courses that do not set one +COURSE_MODE_DEFAULTS = ENV_TOKENS.get('COURSE_MODE_DEFAULTS', COURSE_MODE_DEFAULTS) + # MEDIA_ROOT specifies the directory where user-uploaded files are stored. MEDIA_ROOT = ENV_TOKENS.get('MEDIA_ROOT', MEDIA_ROOT) MEDIA_URL = ENV_TOKENS.get('MEDIA_URL', MEDIA_URL) diff --git a/lms/envs/common.py b/lms/envs/common.py index ad435f1421a0e150c8cb0f2cb4ab8baade6695ab..29790a0170a187665a8a12df943f755866d851f6 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -613,6 +613,18 @@ COURSE_SETTINGS = { } } +COURSE_MODE_DEFAULTS = { + 'bulk_sku': None, + 'currency': 'usd', + 'description': None, + 'expiration_datetime': None, + 'min_price': 0, + 'name': _('Audit'), + 'sku': None, + 'slug': 'audit', + 'suggested_prices': '', +} + # IP addresses that are allowed to reload the course, etc. # TODO (vshnayder): Will probably need to change as we get real access control in. LMS_MIGRATION_ALLOWED_IPS = []