# Generated by Django 2.2.24 on 2022-03-29 16:24

from django.db import migrations


def update_nav_access_restrictions(apps, schema_editor):
    NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
    urls = ['/judging/panel/', '/judging/commitments/', '/nav/judging']
    nav_items = NavTreeItem.objects.filter(url__in=urls)
    # remove user_type restrictions
    nav_items.update(user_type='')
    # remove user_role restrictions
    [nav_item.user_role.clear() for nav_item in nav_items]


class Migration(migrations.Migration):
    dependencies = [
        ('accelerator', '0094_alter_startup_organization_fields'),
    ]

    operations = [
        migrations.RunPython(update_nav_access_restrictions,
                             migrations.RunPython.noop)
    ]

update nav access restrictions