# Generated by Django 2.1.5 on 2019-01-17 20:59
from django.contrib.auth.hashers import make_password
from django.db import migrations


def init_cuenta(apps, schema_editor):
    User = apps.get_model("auth", "User")
    User(
        username="cnvr",
        email="test@example.com",
        password=make_password("xxxx"),
        is_superuser=True,
        is_staff=True
    ).save()


def init_users(apps, schema_editor):
    Cliente = apps.get_model("demo", "Cliente")
    Cliente(
        nombre="Aurélie",
        apellidos="Galea",
        balance=420
    ).save()
    Cliente(
        nombre="Damien",
        apellidos="Narbais",
        balance=420
    ).save()
    Cliente(
        nombre="Kaloyan",
        apellidos="Veselinov",
        balance=420
    ).save()


class Migration(migrations.Migration):

    dependencies = [
        ('demo', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(init_cuenta),
        migrations.RunPython(init_users)
    ]
