bookwyrm-mastodon/bookwyrm/management/commands/admin_code.py

24 lines
715 B
Python
Raw Permalink Normal View History

2022-02-17 13:59:28 -05:00
""" Get your admin code to allow install """
from django.core.management.base import BaseCommand
from bookwyrm import models
2022-02-17 14:31:52 -05:00
2022-02-17 13:59:28 -05:00
def get_admin_code():
"""get that code"""
return models.SiteSettings.objects.get().admin_code
2022-02-17 14:31:52 -05:00
2022-02-17 13:59:28 -05:00
class Command(BaseCommand):
"""command-line options"""
help = "Gets admin code for configuring BookWyrm"
# pylint: disable=unused-argument
def handle(self, *args, **options):
"""execute init"""
self.stdout.write("*******************************************")
self.stdout.write("Use this code to create your admin account:")
2022-02-17 13:59:28 -05:00
self.stdout.write(get_admin_code())
self.stdout.write("*******************************************")