diff --git a/doc/discussion.md b/doc/discussion.md index 4f8ab9a01a..2446485497 100644 --- a/doc/discussion.md +++ b/doc/discussion.md @@ -9,7 +9,7 @@ If you haven't done so already: brew install mongodb Make sure that you have mongodb running. You can simply open a new terminal tab and type: - + mongod ## Installing elasticsearch @@ -72,9 +72,9 @@ For convenience, add the following environment variables to the terminal (assumi export DJANGO_SETTINGS_MODULE=lms.envs.dev export PYTHONPATH=. -Now initialzie roles and permissions: +Now initialzie roles and permissions, providing a course id eg.: - django-admin.py seed_permissions_roles + django-admin.py seed_permissions_roles "MITx/6.002x/2012_Fall" To assign yourself as a moderator, use the following command (assuming your username is "test", and the course id is "MITx/6.002x/2012_Fall"): diff --git a/lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py b/lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py index 5987d5c677..f303abf930 100644 --- a/lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py +++ b/lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py @@ -7,8 +7,10 @@ class Command(BaseCommand): help = 'Seed default permisssions and roles' def handle(self, *args, **options): - if len(args) != 1: - raise CommandError("The number of arguments does not match. ") + if len(args) == 0: + raise CommandError("Please provide a course id") + if len(args) > 1: + raise CommandError("Too many arguments") course_id = args[0] administrator_role = Role.objects.get_or_create(name="Administrator", course_id=course_id)[0] moderator_role = Role.objects.get_or_create(name="Moderator", course_id=course_id)[0]