Commit 034ac1c8 by Arbab Nazar

Merge pull request #10271 from edx/arbab/enrollment-user-list

take the list of users for enrolment change
parents b50daf5f 85e67bea
......@@ -17,7 +17,11 @@ class Command(BaseCommand):
Change enrollment for user joe from audit to honor:
$ ... change_enrollment -u joe -c some/course/id --from audit --to honor
$ ... change_enrollment -u joe,frank,bill -c some/course/id --from audit --to honor
Or
$ ... change_enrollment -u "joe@example.com,frank@example.com,bill@example.com" -c some/course/id --from audit --to honor
Change enrollment for all users in some/course/id from audit to honor
......@@ -40,7 +44,7 @@ class Command(BaseCommand):
metavar='USER',
dest='user',
default=False,
help="User to move, if not specified will move all users in the course"),
help="Comma-separated list of users to move in the course"),
make_option('-c', '--course',
metavar='COURSE_ID',
dest='course_id',
......@@ -70,10 +74,12 @@ class Command(BaseCommand):
mode=options['from_mode']
)
if options['user']:
if '@' in options['user']:
user = User.objects.get(email=options['user'])
user_str = options['user']
for username in user_str.split(","):
if '@' in username:
user = User.objects.get(email=username)
else:
user = User.objects.get(username=options['user'])
user = User.objects.get(username=username)
filter_args['user'] = user
enrollments = CourseEnrollment.objects.filter(**filter_args)
if options['noop']:
......
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