# Generated by Django 3.0.2 on 2020-02-01 17:22

from django.db import migrations


OBJECTS_TO_CREATE = 5


def generate_initial_data(apps, schema_editor):
    Person = apps.get_model('concierge', 'Person')
    Apartment = apps.get_model('concierge', 'Apartment')
    Key = apps.get_model('concierge', 'Key')

    for i in range(OBJECTS_TO_CREATE):
        person = Person(name=f'test_person_name_{i + 1}')
        person.save()
        apartment = Apartment(number=i)
        apartment.save()
        key = Key(apartment=apartment)
        key.save()


class Migration(migrations.Migration):
    dependencies = [
        ('concierge', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(generate_initial_data),
    ]
