# Generated by Django 3.2.5 on 2022-10-14 10:50

from django.conf import settings
from django.db import migrations





# RUN ON MIGRATIONS  -- remigrate if work_model is updated 

def update_flow_model(apps, schema_editor):
    flowmodel = apps.get_model("finflo.Flowmodel")
    try:
        a = settings.FINFLO['WORK_MODEL']
        db_alias = schema_editor.connection.alias
        for i in a:
            flowmodel.objects.using(db_alias).update_or_create(description = i)
    except:
        raise LookupError("Couldn't find work_model in settings.py check documentation")


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(update_flow_model)
    ]