# Generated by Django 2.2.10 on 2021-11-24 16:41
import swapper
from django.db import migrations


def add_startup_profile_top_nav(apps, schema_editor):
    NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
    NavTree = swapper.load_model('accelerator', 'NavTree')
    nav_items = [
        {"title": 'My Startups',
         'alias': 'my_startup',
         'url': '/mystartups'},
        {"title": 'Dashboard',
         'alias': 'dashbaord',
         'urlaspattern': True,
         'url': 'startup_dashboard startup.id'},
        {"title": 'Company Profile',
         'alias': 'company_profile',
         'urlaspattern': True,
         'url': 'startup_profile startup.id'},
        {"title": 'Business Proposition',
         'alias': 'business_proposition',
         'urlaspattern': True,
         'url': 'business_proposition_view startup.id'},
        {"title": 'Progress',
         'alias': 'progress',
         'urlaspattern': True,
         'url': 'startup_update_view startup.id'},
        {"title": 'Team',
         'alias': 'startup_team',
         'urlaspattern': True,
         'url': 'startup_team_view startup.id'},
    ]
    nav_tree = NavTree.objects.filter(
        alias='startup_profile_manager_subnav').first()
    if not nav_tree:
        nav_tree = NavTree.objects.create(
            title='Startup Profile Manager',
            alias='startup_profile_manager_subnav')

    for item in nav_items:
        item['tree_id'] = nav_tree.id
        nav_item = NavTreeItem.objects.filter(
            alias=item['alias'],
            tree__pk=item['tree_id']).exists()
        if not nav_item:
            NavTreeItem.objects.create(**item)


class Migration(migrations.Migration):
    dependencies = [
        ('accelerator', '0105_inclusion_of_business_proposition_model_changes'),
    ]
    operations = [
        migrations.RunPython(add_startup_profile_top_nav,
                             migrations.RunPython.noop)
    ]

# Generated by Django 2.2.10 on 2021-11-24 16:41
import swapper
from django.db import migrations


def add_startup_profile_top_nav(apps, schema_editor):
    NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
    NavTree = swapper.load_model('accelerator', 'NavTree')
    nav_items = [
        {"title": 'My Startups',
         'alias': 'my_startup',
         'url': '/mystartups'},
        {"title": 'Dashboard',
         'alias': 'dashbaord',
         'urlaspattern': True,
         'url': 'startup_dashboard startup.id'},
        {"title": 'Company Profile',
         'alias': 'company_profile',
         'urlaspattern': True,
         'url': 'startup_profile startup.id'},
        {"title": 'Business Proposition',
         'alias': 'business_proposition',
         'urlaspattern': True,
         'url': 'business_proposition_view startup.id'},
        {"title": 'Progress',
         'alias': 'progress',
         'urlaspattern': True,
         'url': 'startup_update_view startup.id'},
        {"title": 'Team',
         'alias': 'startup_team',
         'urlaspattern': True,
         'url': 'startup_team_view startup.id'},
    ]
    nav_tree = NavTree.objects.filter(
        alias='startup_profile_manager_subnav').first()
    if not nav_tree:
        nav_tree = NavTree.objects.create(
            title='Startup Profile Manager',
            alias='startup_profile_manager_subnav')

    for item in nav_items:
        item['tree_id'] = nav_tree.id
        nav_item = NavTreeItem.objects.filter(
            alias=item['alias'],
            tree__pk=item['tree_id']).exists()
        if not nav_item:
            NavTreeItem.objects.create(**item)


class Migration(migrations.Migration):
    dependencies = [
        ('accelerator',
         '0105_inclusion_of_business_proposition_model_changes'),
    ]
    operations = [
        migrations.RunPython(add_startup_profile_top_nav,
                             migrations.RunPython.noop)
    ]

add new changes