mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-29 22:47:00 -05:00
feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__)))
|
||||
@@ -7,13 +8,14 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "thrillwiki.settings")
|
||||
django.setup()
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
def ensure_admin():
|
||||
username = "admin"
|
||||
email = "admin@example.com"
|
||||
password = "adminpassword"
|
||||
|
||||
|
||||
if not User.objects.filter(username=username).exists():
|
||||
print(f"Creating superuser {username}...")
|
||||
User.objects.create_superuser(username=username, email=email, password=password, role="ADMIN")
|
||||
|
||||
Reference in New Issue
Block a user