# Generated by Django 4.2 on 2023-04-30 15:40

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


class Migration(migrations.Migration):
    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('safety', '0008_rename_permissiongroup_objectgroup'),
    ]

    operations = [
        migrations.AlterField(
            model_name='objectgroup',
            name='permissions',
            field=models.ManyToManyField(blank=True, to='auth.permission', verbose_name='Permissions'),
        ),
        migrations.AlterField(
            model_name='objectgroup',
            name='target_ct',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='obj_group_target_ct_of',
                                    to='contenttypes.contenttype', verbose_name='Target Content Type'),
        ),
        migrations.AlterField(
            model_name='objectpermission',
            name='object_ct',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
                                    related_name='object_of', to='contenttypes.contenttype',
                                    verbose_name='Target Content Type'),
        ),
        migrations.AlterField(
            model_name='objectpermission',
            name='object_id',
            field=models.IntegerField(null=True, verbose_name='Object ID'),
        ),
        migrations.CreateModel(
            name='ObjectGroupUser',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='safety.objectgroup',
                                            verbose_name='Group')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
                                           verbose_name='User')),
            ],
        ),
        migrations.RemoveField(
            model_name='objectgroup',
            name='users',
        ),
        migrations.AddField(
            model_name='objectgroup',
            name='users',
            field=models.ManyToManyField(through='safety.ObjectGroupUser', to=settings.AUTH_USER_MODEL,
                                         verbose_name='Users'),
        ),
    ]
