Format Python code with black

This commit is contained in:
kpj
2022-02-27 15:26:41 +01:00
parent f0ffc69010
commit c56cb25b5f
136 changed files with 6142 additions and 3811 deletions

View File

@@ -12,16 +12,18 @@ class Command(BaseCommand):
help = """
Creates a Django superuser based on env variables.
""".replace(" ", "")
""".replace(
" ", ""
)
def handle(self, *args, **options):
username = os.getenv('PAPERLESS_ADMIN_USER')
username = os.getenv("PAPERLESS_ADMIN_USER")
if not username:
return
mail = os.getenv('PAPERLESS_ADMIN_MAIL', 'root@localhost')
password = os.getenv('PAPERLESS_ADMIN_PASSWORD')
mail = os.getenv("PAPERLESS_ADMIN_MAIL", "root@localhost")
password = os.getenv("PAPERLESS_ADMIN_PASSWORD")
# Check if user exists already, leave as is if it does
if User.objects.filter(username=username).exists():
@@ -32,11 +34,10 @@ class Command(BaseCommand):
elif password:
# Create superuser based on env variables
User.objects.create_superuser(username, mail, password)
self.stdout.write(
f'Created superuser "{username}" with provided password.')
self.stdout.write(f'Created superuser "{username}" with provided password.')
else:
self.stdout.write(
f'Did not create superuser "{username}".')
self.stdout.write(f'Did not create superuser "{username}".')
self.stdout.write(
'Make sure you specified "PAPERLESS_ADMIN_PASSWORD" in your '
'"docker-compose.env" file.')
'"docker-compose.env" file.'
)