Added groups_id to management command 'createopenslidesuser'.

This commit is contained in:
Emanuel Schütze 2017-01-11 13:27:07 +01:00
parent 962c06c85f
commit a6807d77bf

View File

@ -26,10 +26,16 @@ class Command(BaseCommand):
'password',
help='The password of the new user.'
)
parser.add_argument(
'groups_id',
help='The group id of the new user.'
)
def handle(self, *args, **options):
user_data = {
'first_name': options['first_name'],
'last_name': options['last_name'],
}
User.objects.create_user(options['username'], options['password'], **user_data)
user = User.objects.create_user(options['username'], options['password'], **user_data)
if options['groups_id'].isdigit():
user.groups.add(int(options['groups_id']))