make import_user command more verbose
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Moritz 2024-05-06 12:12:12 +02:00
parent d1f091da62
commit fc33f285f4
1 changed files with 4 additions and 0 deletions

View File

@ -55,15 +55,19 @@ with open('/tmp/$1', newline='') as file:
email = row[2].strip()
groups = row[3].split(';')
if User.objects.filter(username=username):
print(f'{username} already exists')
continue
new_user = User.objects.create(name=name, username=username, email=email)
print(f'{username} created')
for group_name in groups:
group_name = group_name.strip()
if Group.objects.filter(name=group_name):
group = Group.objects.get(name=group_name)
else:
group = Group.objects.create(name=group_name)
print(f'{group_name} created')
group.users.add(new_user)
print(f'add {username} to group {group_name}')
""" 2>&1 | quieten
}