20 lines
734 B
Python
20 lines
734 B
Python
import sys
|
|
import textwrap
|
|
|
|
from django.contrib.auth import get_user_model
|
|
from django.core.management import execute_from_command_line
|
|
|
|
|
|
def create_initial_superuser(**kwargs):
|
|
if '--noinput' not in sys.argv and '--fake' not in sys.argv and '--fake-initial' not in sys.argv and 'accounts' in sys.argv:
|
|
model = get_user_model()
|
|
if not model.objects.filter(is_superuser=True).exists():
|
|
sys.stdout.write(textwrap.dedent("""
|
|
It appears that you just installed Accounts application.
|
|
You can now create a superuser:
|
|
|
|
""")
|
|
)
|
|
manager = sys.argv[0]
|
|
execute_from_command_line(argv=[manager, 'createsuperuser'])
|