Reformatting & cleanup
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from core.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.utils.crypto import get_random_string
|
||||
import uuid
|
||||
import traceback
|
||||
|
||||
from core.models import User
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -12,8 +14,7 @@ class Command(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"hostname",
|
||||
type=str,
|
||||
"hostname", type=str,
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
@@ -24,4 +25,4 @@ class Command(BaseCommand):
|
||||
self.style.SUCCESS(
|
||||
f"Successfully set the hostname to '{options.get('hostname')}'"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from core.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.utils.crypto import get_random_string
|
||||
import uuid
|
||||
import traceback
|
||||
|
||||
from core.models import User
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -12,18 +14,13 @@ class Command(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"email",
|
||||
type=str,
|
||||
"email", type=str,
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
email = options.get("email")
|
||||
password = get_random_string()
|
||||
User.objects.create_superuser(
|
||||
str(uuid.uuid4()), email=email, password=password
|
||||
)
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS("Successfully created a Shynet superuser")
|
||||
)
|
||||
User.objects.create_superuser(str(uuid.uuid4()), email=email, password=password)
|
||||
self.stdout.write(self.style.SUCCESS("Successfully created a Shynet superuser"))
|
||||
self.stdout.write(f"Email address: {email}")
|
||||
self.stdout.write(f"Password: {password}")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from core.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.utils.crypto import get_random_string
|
||||
import uuid
|
||||
import traceback
|
||||
|
||||
from core.models import User
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -12,8 +14,7 @@ class Command(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"name",
|
||||
type=str,
|
||||
"name", type=str,
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
@@ -24,4 +25,4 @@ class Command(BaseCommand):
|
||||
self.style.SUCCESS(
|
||||
f"Successfully set the whitelabel to '{options.get('name')}'"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user