Commit 2b25c9fc by Giulio Gratta Committed by Clinton Blackburn

Enable DEFAULT_MODE to be customized in config

- Keeps platform set default of "Audit" to be backwards compatible and not break stuff
- get COURSE_MODE_DEFAULTS from config if set
parent 10ec774c
......@@ -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,
......
......@@ -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]
......
......@@ -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)
......
......@@ -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 = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment