From d7eab8e1a312f61f3edc0dd36a62220a3b5a6f65 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 11 May 2022 20:48:26 +1000 Subject: [PATCH] Improve log output --- InvenTree/InvenTree/apps.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/apps.py b/InvenTree/InvenTree/apps.py index 89b2edddda..3b09688162 100644 --- a/InvenTree/InvenTree/apps.py +++ b/InvenTree/InvenTree/apps.py @@ -190,9 +190,11 @@ class InvenTreeConfig(AppConfig): user = get_user_model() try: with transaction.atomic(): - if not user.objects.filter(username=add_user).exists(): + if user.objects.filter(username=add_user).exists(): + logger.info(f"User {str(new_user)} already exists - skipping creation") + else: new_user = user.objects.create_superuser(add_user, add_email, add_password) - logger.info(f'User {str(new_user)} was created!') + logger.info(f'User {str(new_user)} was created!') except IntegrityError as _e: logger.warning(f'The user "{add_user}" could not be created due to the following error:\n{str(_e)}') if settings.TESTING_ENV: