# Generated by Django 3.0.6 on 2020-05-23 14:43

from django.db import migrations, models
import django_utils.choices


def remove_regex_rules(apps, schema_editor):
    rule_model = apps.get_model("elections.VoterAuthorizationRule")
    rule_model.objects.exclude(type=0).delete()


class Migration(migrations.Migration):

    dependencies = [
        ("elections", "0009_store_encrypted_vote"),
    ]

    operations = [
        migrations.AddField(
            model_name="election",
            name="visibility",
            field=models.PositiveSmallIntegerField(
                choices=[
                    (0, django_utils.choices.Choice(0, "PRIVATE")),
                    (1, django_utils.choices.Choice(1, "PUBLIC")),
                ],
                default=1,
            ),
            preserve_default=False,
        ),
        migrations.RunPython(remove_regex_rules),
        migrations.AlterField(
            model_name="election",
            name="visibility",
            field=models.PositiveSmallIntegerField(
                choices=[
                    (0, django_utils.choices.Choice(0, "PRIVATE")),
                    (1, django_utils.choices.Choice(1, "PUBLIC")),
                ],
                default=0,
            ),
        ),
        migrations.AlterField(
            model_name="voterauthorizationrule",
            name="type",
            field=models.IntegerField(
                choices=[(0, django_utils.choices.Choice(0, "EXACT"))]
            ),
        ),
    ]
