# Generated by Django 3.1.1 on 2020-10-20 10:39 from django.db import migrations, models import django.utils.timezone def register_phases(apps, schema_editor): """ Import the different phases of the action """ Phase = apps.get_model("participation", "phase") Phase.objects.get_or_create( phase_number=1, description="Soumission des vidéos", ) Phase.objects.get_or_create( phase_number=2, description="Phase de questions", ) Phase.objects.get_or_create( phase_number=3, description="Phase d'échanges entre les équipes", ) Phase.objects.get_or_create( phase_number=4, description="Synthèse de l'échange", ) def reverse_phase_registering(apps, _): # pragma: no cover """ Drop all phases in order to unapply this migration. """ Phase = apps.get_model("participation", "phase") Phase.objects.all().delete() class Migration(migrations.Migration): dependencies = [ ('participation', '0005_participation_valid'), ] operations = [ migrations.CreateModel( name='Phase', fields=[ ('phase_number', models.AutoField(primary_key=True, serialize=False, unique=True, verbose_name='phase number')), ('description', models.CharField(max_length=255, verbose_name="phase description")), ('start', models.DateTimeField(default=django.utils.timezone.now, verbose_name='start date of the given phase')), ('end', models.DateTimeField(default=django.utils.timezone.now, verbose_name='end date of the given phase')), ], options={ 'verbose_name': 'phase', 'verbose_name_plural': 'phases', }, ), migrations.RunPython( register_phases, reverse_phase_registering, ), ]