from django.core.management import BaseCommand

from core.factories import UserFactory
from users.services import create_users, create_student
from .data.user_data import user_data

from users.models import User

class Command(BaseCommand):
    def handle(self, *args, **options):
        UserFactory(
            username='test',
            is_staff=True,
            is_superuser=True,
            first_name='Nicol',
            last_name='Bolas',
            onboarding_visited=True
        )

        create_users(user_data)

        # create student without class
        create_student(
            username='hansli',
            first_name='Hansli',
            last_name='Alleini'
        )

        users = User.objects.all()

        for usr in users:
            print(usr.email)
            usr.set_password('test')
            usr.save()


