# Generated by Django 2.1.2 on 2018-10-05 11:58

from django.db import migrations
from django_seed import Seed


def create_dummy_data(apps, schema_editor):
    seeder = Seed.seeder()

    Developer = apps.get_model("searchapp", 'Developer')
    ProgrammingLanguage = apps.get_model("searchapp", 'ProgrammingLanguage')
    Language = apps.get_model("searchapp", 'Language')

    programming_language_list = ['php', 'ruby', 'javascript', 'python', 'scala', 'kotlin', 'swift']

    for i in range(1, len(programming_language_list) + 1):
        programming_language = ProgrammingLanguage(id=i, name=programming_language_list[i-1])
        programming_language.save()

    language_list = ['bd', 'vn', 'en', 'ja']

    for i in range(1, len(language_list) + 1):
        language = Language(id=i, code=language_list[i-1])
        language.save()

    seeder.add_entity(Developer, 110, {
        'email': lambda x: seeder.faker.email()
    })
    seeder.execute()


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

    operations = [
        migrations.RunPython(create_dummy_data),
    ]
