From a6807d77bf21325b3642740aa541e3a0c6d369ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Wed, 11 Jan 2017 13:27:07 +0100 Subject: [PATCH] Added groups_id to management command 'createopenslidesuser'. --- .../users/management/commands/createopenslidesuser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openslides/users/management/commands/createopenslidesuser.py b/openslides/users/management/commands/createopenslidesuser.py index 095c7b7cc..56419d524 100644 --- a/openslides/users/management/commands/createopenslidesuser.py +++ b/openslides/users/management/commands/createopenslidesuser.py @@ -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']))