2020-11-04 12:13:34 +00:00
# Generated by Django 3.1.3 on 2020-11-04 12:05
2020-09-21 15:53:07 +00:00
import django . core . validators
from django . db import migrations , models
2020-11-04 12:13:34 +00:00
import django . utils . timezone
def register_phases ( apps , _ ) :
"""
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 ( )
2020-09-21 15:53:07 +00:00
class Migration ( migrations . Migration ) :
initial = True
dependencies = [
]
operations = [
migrations . CreateModel (
name = ' Participation ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2020-10-31 12:36:03 +00:00
( ' problem ' , models . IntegerField ( choices = [ ( 1 , ' Problem #1 ' ) , ( 2 , ' Problem #2 ' ) , ( 3 , ' Problem #3 ' ) ] , default = None , null = True , verbose_name = ' problem number ' ) ) ,
2020-11-04 12:13:34 +00:00
( ' valid ' , models . BooleanField ( default = None , help_text = ' The video got the validation of the administrators. ' , null = True , verbose_name = ' valid ' ) ) ,
2020-09-21 15:53:07 +00:00
] ,
options = {
' verbose_name ' : ' participation ' ,
' verbose_name_plural ' : ' participations ' ,
} ,
) ,
2020-11-04 12:13:34 +00:00
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 . CreateModel (
name = ' Question ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' question ' , models . TextField ( verbose_name = ' question ' ) ) ,
] ,
) ,
2020-09-21 15:53:07 +00:00
migrations . CreateModel (
name = ' Team ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' name ' , models . CharField ( max_length = 255 , unique = True , verbose_name = ' name ' ) ) ,
2020-09-23 21:20:44 +00:00
( ' trigram ' , models . CharField ( help_text = ' The trigram must be composed of three uppercase letters. ' , max_length = 3 , unique = True , validators = [ django . core . validators . RegexValidator ( ' [A-Z] {3} ' ) ] , verbose_name = ' trigram ' ) ) ,
2020-09-21 15:53:07 +00:00
( ' access_code ' , models . CharField ( help_text = ' The access code let other people to join the team. ' , max_length = 6 , verbose_name = ' access code ' ) ) ,
2020-11-04 12:13:34 +00:00
( ' grant_animath_access_videos ' , models . BooleanField ( default = False , help_text = ' Give the authorisation to publish the video on the main website to promote the action. ' , verbose_name = ' Grant Animath to publish my video ' ) ) ,
2020-09-21 15:53:07 +00:00
] ,
options = {
' verbose_name ' : ' team ' ,
' verbose_name_plural ' : ' teams ' ,
} ,
) ,
migrations . CreateModel (
name = ' Video ' ,
fields = [
( ' id ' , models . AutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' link ' , models . URLField ( help_text = ' The full video link. ' , verbose_name = ' link ' ) ) ,
( ' valid ' , models . BooleanField ( default = None , help_text = ' The video got the validation of the administrators. ' , null = True , verbose_name = ' valid ' ) ) ,
] ,
options = {
' verbose_name ' : ' video ' ,
' verbose_name_plural ' : ' videos ' ,
} ,
) ,
migrations . AddIndex (
model_name = ' team ' ,
index = models . Index ( fields = [ ' trigram ' ] , name = ' participati_trigram_239255_idx ' ) ,
) ,
2020-11-04 12:13:34 +00:00
migrations . AddField (
model_name = ' question ' ,
name = ' participation ' ,
field = models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , related_name = ' questions ' , to = ' participation.participation ' , verbose_name = ' participation ' ) ,
) ,
2020-09-21 15:53:07 +00:00
migrations . AddField (
model_name = ' participation ' ,
name = ' received_participation ' ,
field = models . OneToOneField ( default = None , null = True , on_delete = django . db . models . deletion . PROTECT , related_name = ' sent_participation ' , to = ' participation.participation ' , verbose_name = ' received participation ' ) ,
) ,
migrations . AddField (
model_name = ' participation ' ,
name = ' solution ' ,
2020-11-04 12:13:34 +00:00
field = models . OneToOneField ( default = None , null = True , on_delete = django . db . models . deletion . SET_NULL , related_name = ' participation_solution ' , to = ' participation.video ' , verbose_name = ' solution video ' ) ,
2020-09-21 15:53:07 +00:00
) ,
migrations . AddField (
model_name = ' participation ' ,
name = ' synthesis ' ,
2020-11-04 12:13:34 +00:00
field = models . OneToOneField ( default = None , null = True , on_delete = django . db . models . deletion . SET_NULL , related_name = ' participation_synthesis ' , to = ' participation.video ' , verbose_name = ' synthesis video ' ) ,
2020-09-21 15:53:07 +00:00
) ,
migrations . AddField (
model_name = ' participation ' ,
name = ' team ' ,
field = models . OneToOneField ( on_delete = django . db . models . deletion . CASCADE , to = ' participation.team ' , verbose_name = ' team ' ) ,
) ,
2020-11-04 12:13:34 +00:00
migrations . RunPython (
register_phases ,
reverse_code = reverse_phase_registering ,
)
2020-09-21 15:53:07 +00:00
]