# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-10-18 09:04
from __future__ import unicode_literals

import os
import json

from django.db import migrations, models


fixture_dir = os.path.abspath(
    os.path.join(os.path.dirname(__file__), '../fixtures'))
fixture_file = os.path.join(fixture_dir, 'solarcurrency_initial.json')


def load_initial_data(apps, schema_editor):
    SolarCurrency = apps.get_model('solarcurrency', 'SolarCurrency')
    with open(fixture_file) as f:
        initial_data = json.loads(f.read())
        for data in initial_data:
            fields = data['fields']
            SolarCurrency.objects.create(**fields)


def backwards_func(apps, schema_editor):
    pass


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(load_initial_data, backwards_func)
    ]
