ipv6-dot-work/jobs/management/commands/create_test_users.py

25 lines
680 B
Python

from django.core.management import BaseCommand
from django.contrib.auth import get_user_model
User = get_user_model()
class Command(BaseCommand):
help = "Create test accounts. Don't use this in production!"
def handle(self, *args, **options):
user_fixture = [
{
'username': 'user1',
'email': 'user1@dev.ipv6.work',
'password': 'user1'
},
{
'username': 'user2',
'email': 'user2@dev.ipv6.work',
'password': 'user2'
},
]
for user_data in user_fixture:
User.objects.create_user(**user_data)