# Generated by Django 2.2.6 on 2019-10-24 02:03

import json

from django.db import migrations

from src.models import Subject


def my_function(apps, schema_editor):
    data = []
    print(11111111111111111)
    with open('src/fakerdata/subject.json') as f:
        seats = json.load(f)
        print()
        for item in seats:
            print(item)
            seat = Subject(name=item['name'], code=item['code'])
            data.append(seat)
        Subject.objects.bulk_create(data)


class Migration(migrations.Migration):
    dependencies = [
        ('src', '0003_auto_20191024_0934'),
    ]

    operations = [
        migrations.RunPython(my_function)

    ]
