A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix code guidelines
Chris Nagyc3d708816857
diff --git a/src/documents/management/commands/manage_superuser.py b/src/documents/management/commands/manage_superuser.pyindex 0762ab001..81732e7d9 100644--- a/src/documents/management/commands/manage_superuser.py+++ b/src/documents/management/commands/manage_superuser.py@@ -3,6 +3,7 @@ import osfrom django.contrib.auth.models import Userfrom django.core.management.base import BaseCommand, CommandError+class Command(BaseCommand):help = """@@ -11,23 +12,29 @@ class Command(BaseCommand):def handle(self, *args, **options):- # Get user details from env variables- PAPERLESS_ADMIN_USER=os.getenv('PAPERLESS_ADMIN_USER')- PAPERLESS_ADMIN_MAIL=os.getenv('PAPERLESS_ADMIN_MAIL', 'root@localhost')- PAPERLESS_ADMIN_PASSWORD=os.getenv('PAPERLESS_ADMIN_PASSWORD')+ PAPERLESS_ADMIN_USER = os.getenv('PAPERLESS_ADMIN_USER')+ PAPERLESS_ADMIN_MAIL = os.getenv('PAPERLESS_ADMIN_MAIL', 'root@localhost')+ PAPERLESS_ADMIN_PASSWORD = os.getenv('PAPERLESS_ADMIN_PASSWORD')# If PAPERLESS_ADMIN_USER env variable is setif PAPERLESS_ADMIN_USER:try:# Check if user exists already, leave as is if it does- if User.objects.filter(username=PAPERLESS_ADMIN_USER).exists():- self.stdout.write(f'The user "{PAPERLESS_ADMIN_USER}" already exists! Leaving user as is.')+ if User.objects.filter(+ username=PAPERLESS_ADMIN_USER).exists():+ self.stdout.write(+ f'The user "{PAPERLESS_ADMIN_USER}" already exists! Leaving user as is.')elif PAPERLESS_ADMIN_PASSWORD:# Create superuser based on env variables- User.objects.create_superuser(PAPERLESS_ADMIN_USER, PAPERLESS_ADMIN_MAIL, PAPERLESS_ADMIN_PASSWORD)- self.stdout.write(f'Created superuser "{PAPERLESS_ADMIN_USER}" with provided password.')+ User.objects.create_superuser(+ PAPERLESS_ADMIN_USER, PAPERLESS_ADMIN_MAIL, PAPERLESS_ADMIN_PASSWORD)+ self.stdout.write(+ f'Created superuser "{PAPERLESS_ADMIN_USER}" with provided password.')else:- self.stdout.write(f'Did not create superuser "{PAPERLESS_ADMIN_USER}".')- self.stdout.write('Make sure you specified "PAPERLESS_ADMIN_PASSWORD" in your "docker-compose.env" file.')+ self.stdout.write(+ f'Did not create superuser "{PAPERLESS_ADMIN_USER}".')+ self.stdout.write(+ 'Make sure you specified "PAPERLESS_ADMIN_PASSWORD" in your "docker-compose.env" file.')except Exception as error:- self.stdout.write(f'Exception occured while creating superuser: {error}')+ self.stdout.write(+ f'Exception occured while creating superuser: {error}')