Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
6802a38a
Commit
6802a38a
authored
6 years ago
by
Dave St.Germain
Browse files
Options
Downloads
Patches
Plain Diff
Added master's track
Added mode option to course enrollment management command
parent
4b4957ad
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/enrollment/management/commands/enroll_user_in_course.py
+12
-3
12 additions, 3 deletions
...s/enrollment/management/commands/enroll_user_in_course.py
lms/envs/common.py
+6
-0
6 additions, 0 deletions
lms/envs/common.py
with
18 additions
and
3 deletions
common/djangoapps/enrollment/management/commands/enroll_user_in_course.py
+
12
−
3
View file @
6802a38a
...
...
@@ -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
This diff is collapsed.
Click to expand it.
lms/envs/common.py
+
6
−
0
View file @
6802a38a
...
...
@@ -3383,6 +3383,12 @@ COURSE_ENROLLMENT_MODES = {
"
display_name
"
:
_
(
"
Honor
"
),
"
min_price
"
:
0
},
"
masters
"
:
{
"
id
"
:
7
,
"
slug
"
:
"
masters
"
,
"
display_name
"
:
_
(
"
Master
'
s
"
),
"
min_price
"
:
0
},
}
CONTENT_TYPE_GATE_GROUP_IDS
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment