# Generated by Django 2.2.22 on 2021-06-10 12:06

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


def sync_admins_and_staff(apps, schema_editor):
    """
    Function for making all existing superusers also staff members.
    """
    User = apps.get_model("auth", "User")
    for user in User.objects.filter(is_superuser=True, is_staff=False):
        user.is_staff = True
        user.save()


class Migration(migrations.Migration):
    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('core', '0015_project_administrators'),
    ]

    operations = [
        migrations.RunPython(sync_admins_and_staff)
    ]
