# Generated by Django 3.2.12 on 2022-03-14 16:59

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):
    dependencies = [
        ("groups", "0009_auto_20220218_1043"),
        ("people", "0015_add_person_created_id_index"),
        ("events", "0019_auto_20220314_1245"),
    ]

    operations = [
        migrations.CreateModel(
            name="GroupAttendee",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="date de création",
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        auto_now=True, verbose_name="dernière modification"
                    ),
                ),
                (
                    "event",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="event_participation",
                        to="events.event",
                    ),
                ),
                (
                    "group",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="group_participation",
                        to="groups.supportgroup",
                    ),
                ),
                (
                    "organizer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="group_event_participation",
                        to="people.person",
                    ),
                ),
            ],
            options={
                "verbose_name": "Group attendee for an event",
                "unique_together": {("event", "group")},
            },
        ),
        migrations.AddField(
            model_name="event",
            name="groups_attendees",
            field=models.ManyToManyField(
                related_name="attended_event",
                through="events.GroupAttendee",
                to="groups.SupportGroup",
            ),
        ),
    ]
