Added groups_id to management command 'createopenslidesuser'.
This commit is contained in:
parent
962c06c85f
commit
a6807d77bf
@ -26,10 +26,16 @@ class Command(BaseCommand):
|
|||||||
'password',
|
'password',
|
||||||
help='The password of the new user.'
|
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):
|
def handle(self, *args, **options):
|
||||||
user_data = {
|
user_data = {
|
||||||
'first_name': options['first_name'],
|
'first_name': options['first_name'],
|
||||||
'last_name': options['last_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']))
|
||||||
|
Loading…
Reference in New Issue
Block a user