Skip to content
Snippets Groups Projects
0009_group_roles.py 2.70 KiB
# Generated by Django 3.1.5 on 2021-02-07 15:21

import aleksis.apps.chronos.managers
from aleksis.core.util.model_helpers import ICONS
import colorfield.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0009_default_dashboard'),
        ('sites', '0002_alter_domain_unique'),
        ('alsijil', '0008_global_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='GroupRole',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('extended_data', models.JSONField(default=dict, editable=False)),
                ('name', models.CharField(max_length=255, verbose_name='Name')),
                ('icon', models.CharField(blank=True, choices=(lambda: ICONS)(), max_length=50, verbose_name='Icon')),
                ('colour', colorfield.fields.ColorField(blank=True, default='', max_length=18, verbose_name='Colour')),
                ('site', models.ForeignKey(default=1, editable=False, on_delete=django.db.models.deletion.CASCADE, to='sites.site')),
            ],
            options={
                'verbose_name': 'Group role',
                'verbose_name_plural': 'Group roles',
            },
        ),
        migrations.CreateModel(
            name='GroupRoleAssignment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('extended_data', models.JSONField(default=dict, editable=False)),
                ('date_start', models.DateField(verbose_name='Start date')),
                ('date_end', models.DateField(blank=True, help_text='Can be left empty if end date is not clear yet', null=True, verbose_name='End date')),
                ('groups', models.ManyToManyField(related_name='group_roles', to='core.Group', verbose_name='Groups')),
                ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='group_roles', to='core.person', verbose_name='Assigned person')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assignments', to='alsijil.grouprole', verbose_name='Group role')),
                ('site', models.ForeignKey(default=1, editable=False, on_delete=django.db.models.deletion.CASCADE, to='sites.site')),
            ],
            options={
                'verbose_name': 'Group role assignment',
                'verbose_name_plural': 'Group role assignments',
            },
            bases=(aleksis.apps.chronos.managers.GroupPropertiesMixin, models.Model),
        ),
    ]