Merge pull request #19771 from edx/dahlia/masters-track
Added master's track
This commit is contained in:
@@ -143,6 +143,7 @@ class CourseMode(models.Model):
|
||||
AUDIT = 'audit'
|
||||
NO_ID_PROFESSIONAL_MODE = 'no-id-professional'
|
||||
CREDIT_MODE = 'credit'
|
||||
MASTERS = 'masters'
|
||||
|
||||
DEFAULT_MODE = Mode(
|
||||
settings.COURSE_MODE_DEFAULTS['slug'],
|
||||
@@ -157,13 +158,13 @@ class CourseMode(models.Model):
|
||||
)
|
||||
DEFAULT_MODE_SLUG = settings.COURSE_MODE_DEFAULTS['slug']
|
||||
|
||||
ALL_MODES = [AUDIT, CREDIT_MODE, HONOR, NO_ID_PROFESSIONAL_MODE, PROFESSIONAL, VERIFIED, ]
|
||||
ALL_MODES = [AUDIT, CREDIT_MODE, HONOR, NO_ID_PROFESSIONAL_MODE, PROFESSIONAL, VERIFIED, MASTERS, ]
|
||||
|
||||
# Modes utilized for audit/free enrollments
|
||||
AUDIT_MODES = [AUDIT, HONOR]
|
||||
|
||||
# Modes that allow a student to pursue a verified certificate
|
||||
VERIFIED_MODES = [VERIFIED, PROFESSIONAL]
|
||||
VERIFIED_MODES = [VERIFIED, PROFESSIONAL, MASTERS]
|
||||
|
||||
# Modes that allow a student to pursue a non-verified certificate
|
||||
NON_VERIFIED_MODES = [HONOR, AUDIT, NO_ID_PROFESSIONAL_MODE]
|
||||
@@ -174,6 +175,9 @@ class CourseMode(models.Model):
|
||||
# Modes that are eligible to purchase credit
|
||||
CREDIT_ELIGIBLE_MODES = [VERIFIED, PROFESSIONAL, NO_ID_PROFESSIONAL_MODE]
|
||||
|
||||
# Modes for which certificates/programs may need to be updated
|
||||
CERTIFICATE_RELEVANT_MODES = CREDIT_MODES + CREDIT_ELIGIBLE_MODES + [MASTERS]
|
||||
|
||||
# Modes that are allowed to upsell
|
||||
UPSELL_TO_VERIFIED_MODES = [HONOR, AUDIT]
|
||||
|
||||
|
||||
@@ -12,9 +12,10 @@ class Command(BaseCommand):
|
||||
Enroll a user into a course
|
||||
"""
|
||||
help = """
|
||||
This enrolls a user into a given course with the default mode (e.g., 'honor', 'audit', etc).
|
||||
This enrolls a user into a given course
|
||||
|
||||
User email and course ID are required.
|
||||
Mode is optional. It defaults to the default mode (e.g., 'honor', 'audit', etc).
|
||||
|
||||
example:
|
||||
# Enroll a user test@example.com into the demo course
|
||||
@@ -35,7 +36,14 @@ class Command(BaseCommand):
|
||||
'-c', '--course',
|
||||
nargs=1,
|
||||
required=True,
|
||||
help='course ID to enroll the user in')
|
||||
help='course ID to enroll the user in'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-m', '--mode',
|
||||
required=False,
|
||||
default=None,
|
||||
help='course mode to enroll the user in'
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
"""
|
||||
@@ -43,10 +51,11 @@ class Command(BaseCommand):
|
||||
"""
|
||||
email = options['email'][0]
|
||||
course = options['course'][0]
|
||||
mode = options['mode']
|
||||
|
||||
user = User.objects.get(email=email)
|
||||
try:
|
||||
add_enrollment(user.username, course)
|
||||
add_enrollment(user.username, course, mode=mode)
|
||||
except CourseEnrollmentExistsError:
|
||||
# If the user is already enrolled in the course, do nothing.
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user