# Generated by Django 5.2.14 on 2026-05-30 20:00

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


class Migration(migrations.Migration):
    dependencies = [
        ("club", "0017_linktype_clublink"),
        ("election", "0005_alter_candidature_program_alter_candidature_user"),
    ]

    operations = [
        migrations.AddField(
            model_name="election",
            name="clubs",
            field=models.ManyToManyField(
                help_text="The club(s) this election is held for.",
                related_name="elections",
                to="club.club",
                verbose_name="clubs",
            ),
        ),
        migrations.AddField(
            model_name="role",
            name="club_role",
            field=models.ForeignKey(
                blank=True,
                help_text=(
                    "A club role. Filling this will allow automatic "
                    "completion of title and description, "
                    "and automatic assignation after the elections."
                ),
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="election_roles",
                to="club.clubrole",
                verbose_name="club role",
            ),
        ),
        migrations.AlterField(
            model_name="role",
            name="description",
            field=models.TextField(blank=True, default="", verbose_name="description"),
        ),
        migrations.AlterField(
            model_name="role",
            name="max_choice",
            field=models.PositiveSmallIntegerField(
                default=1, verbose_name="max choice"
            ),
        ),
        migrations.AddConstraint(
            model_name="role",
            constraint=models.UniqueConstraint(
                fields=("title", "election"),
                name="title_election_unique_constraint",
                violation_error_code="invalid",
                violation_error_message="This role already exists for this election",
            ),
        ),
    ]
