2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 13:06:45 +00:00

Do not try to create a new admin user if one already exists with that name

This commit is contained in:
Oliver Walters 2022-05-11 20:46:44 +10:00
parent f4e3abd44e
commit 20fa72e36f

View File

@ -190,6 +190,7 @@ class InvenTreeConfig(AppConfig):
user = get_user_model()
try:
with transaction.atomic():
if not user.objects.filter(username=add_user).exists():
new_user = user.objects.create_superuser(add_user, add_email, add_password)
logger.info(f'User {str(new_user)} was created!')
except IntegrityError as _e: