From 067a266997a8df252c8014c2786f0196c956f235 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 19 Sep 2020 20:16:55 +0200 Subject: [PATCH] Commit migrations --- .gitignore | 3 - apps/member/migrations/0001_initial.py | 133 ++++++++++++++++++ .../migrations/0002_auto_20200919_2015.py | 57 ++++++++ apps/tournament/migrations/0001_initial.py | 92 ++++++++++++ entrypoint.sh | 1 - 5 files changed, 282 insertions(+), 4 deletions(-) create mode 100644 apps/member/migrations/0001_initial.py create mode 100644 apps/member/migrations/0002_auto_20200919_2015.py create mode 100644 apps/tournament/migrations/0001_initial.py diff --git a/.gitignore b/.gitignore index aa0a2fc..173574d 100644 --- a/.gitignore +++ b/.gitignore @@ -43,8 +43,5 @@ env/ venv/ db.sqlite3 -# Ignore migrations during first phase dev -migrations/ - # Don't git personal data import_olddb/ diff --git a/apps/member/migrations/0001_initial.py b/apps/member/migrations/0001_initial.py new file mode 100644 index 0000000..fab265e --- /dev/null +++ b/apps/member/migrations/0001_initial.py @@ -0,0 +1,133 @@ +# Generated by Django 3.1 on 2020-09-19 18:15 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0012_alter_user_first_name_max_length'), + ('contenttypes', '0002_remove_content_type_name'), + ] + + operations = [ + migrations.CreateModel( + name='Config', + fields=[ + ('key', models.CharField(max_length=255, primary_key=True, serialize=False, verbose_name='key')), + ('value', models.TextField(default='', verbose_name='value')), + ], + options={ + 'verbose_name': 'configuration', + 'verbose_name_plural': 'configurations', + }, + ), + migrations.CreateModel( + name='Document', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.FileField(unique=True, upload_to='', verbose_name='file')), + ('uploaded_at', models.DateTimeField(auto_now_add=True, verbose_name='uploaded at')), + ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_member.document_set+', to='contenttypes.contenttype')), + ], + options={ + 'verbose_name': 'document', + 'verbose_name_plural': 'documents', + }, + ), + migrations.CreateModel( + name='Authorization', + fields=[ + ('document_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='member.document')), + ('type', models.CharField(choices=[('parental_consent', 'Parental consent'), ('photo_consent', 'Photo consent'), ('sanitary_plug', 'Sanitary plug'), ('scholarship', 'Scholarship')], max_length=32, verbose_name='type')), + ], + options={ + 'verbose_name': 'authorization', + 'verbose_name_plural': 'authorizations', + }, + bases=('member.document',), + ), + migrations.CreateModel( + name='MotivationLetter', + fields=[ + ('document_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='member.document')), + ], + options={ + 'verbose_name': 'motivation letter', + 'verbose_name_plural': 'motivation letters', + }, + bases=('member.document',), + ), + migrations.CreateModel( + name='Solution', + fields=[ + ('document_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='member.document')), + ('problem', models.PositiveSmallIntegerField(verbose_name='problem')), + ('final', models.BooleanField(default=False, verbose_name='final solution')), + ], + options={ + 'verbose_name': 'solution', + 'verbose_name_plural': 'solutions', + }, + bases=('member.document',), + ), + migrations.CreateModel( + name='Synthesis', + fields=[ + ('document_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='member.document')), + ('source', models.CharField(choices=[('opponent', 'Opponent'), ('rapporteur', 'Rapporteur')], max_length=16, verbose_name='source')), + ('round', models.PositiveSmallIntegerField(choices=[(1, 'Round 1'), (2, 'Round 2')], verbose_name='round')), + ('final', models.BooleanField(default=False, verbose_name='final synthesis')), + ], + options={ + 'verbose_name': 'synthesis', + 'verbose_name_plural': 'syntheses', + }, + bases=('member.document',), + ), + migrations.CreateModel( + name='TFJMUser', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('email', models.EmailField(help_text='This should be valid and will be controlled.', max_length=254, unique=True, verbose_name='email')), + ('birth_date', models.DateField(default=None, null=True, verbose_name='birth date')), + ('gender', models.CharField(choices=[('male', 'Male'), ('female', 'Female'), ('non-binary', 'Non binary')], default=None, max_length=16, null=True, verbose_name='gender')), + ('address', models.CharField(default=None, max_length=255, null=True, verbose_name='address')), + ('postal_code', models.PositiveIntegerField(default=None, null=True, verbose_name='postal code')), + ('city', models.CharField(default=None, max_length=255, null=True, verbose_name='city')), + ('country', models.CharField(default='France', max_length=255, null=True, verbose_name='country')), + ('phone_number', models.CharField(blank=True, default=None, max_length=20, null=True, verbose_name='phone number')), + ('school', models.CharField(default=None, max_length=255, null=True, verbose_name='school')), + ('student_class', models.CharField(choices=[('seconde', 'Seconde or less'), ('première', 'Première'), ('terminale', 'Terminale')], default=None, max_length=16, null=True, verbose_name='class')), + ('responsible_name', models.CharField(default=None, max_length=255, null=True, verbose_name='responsible name')), + ('responsible_phone', models.CharField(default=None, max_length=20, null=True, verbose_name='responsible phone')), + ('responsible_email', models.EmailField(default=None, max_length=254, null=True, verbose_name='responsible email')), + ('description', models.TextField(default=None, null=True, verbose_name='description')), + ('role', models.CharField(choices=[('0admin', 'Admin'), ('1volunteer', 'Organizer'), ('2coach', 'Coach'), ('3participant', 'Participant')], max_length=16)), + ('year', models.PositiveIntegerField(default=2020, verbose_name='year')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/apps/member/migrations/0002_auto_20200919_2015.py b/apps/member/migrations/0002_auto_20200919_2015.py new file mode 100644 index 0000000..7997bc8 --- /dev/null +++ b/apps/member/migrations/0002_auto_20200919_2015.py @@ -0,0 +1,57 @@ +# Generated by Django 3.1 on 2020-09-19 18:15 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('member', '0001_initial'), + ('auth', '0012_alter_user_first_name_max_length'), + ('tournament', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='tfjmuser', + name='team', + field=models.ForeignKey(help_text='Concerns only coaches and participants.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='users', to='tournament.team', verbose_name='team'), + ), + migrations.AddField( + model_name='tfjmuser', + name='user_permissions', + field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'), + ), + migrations.AddField( + model_name='synthesis', + name='team', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='syntheses', to='tournament.team', verbose_name='team'), + ), + migrations.AddField( + model_name='solution', + name='team', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='solutions', to='tournament.team', verbose_name='team'), + ), + migrations.AddField( + model_name='motivationletter', + name='team', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='motivation_letters', to='tournament.team', verbose_name='team'), + ), + migrations.AddField( + model_name='authorization', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='authorizations', to=settings.AUTH_USER_MODEL, verbose_name='user'), + ), + migrations.AlterUniqueTogether( + name='synthesis', + unique_together={('team', 'source', 'round', 'final')}, + ), + migrations.AlterUniqueTogether( + name='solution', + unique_together={('team', 'problem', 'final')}, + ), + ] diff --git a/apps/tournament/migrations/0001_initial.py b/apps/tournament/migrations/0001_initial.py new file mode 100644 index 0000000..22ee135 --- /dev/null +++ b/apps/tournament/migrations/0001_initial.py @@ -0,0 +1,92 @@ +# Generated by Django 3.1 on 2020-09-19 18:15 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('member', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Tournament', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255, verbose_name='name')), + ('size', models.PositiveSmallIntegerField(help_text='Number of teams that are allowed to join the tournament.', verbose_name='size')), + ('place', models.CharField(max_length=255, verbose_name='place')), + ('price', models.PositiveSmallIntegerField(help_text='Price asked to participants. Free with a scholarship.', verbose_name='price')), + ('description', models.TextField(verbose_name='description')), + ('date_start', models.DateField(default=django.utils.timezone.now, verbose_name='date start')), + ('date_end', models.DateField(default=django.utils.timezone.now, verbose_name='date end')), + ('date_inscription', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date of registration closing')), + ('date_solutions', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date of maximal solution submission')), + ('date_syntheses', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date of maximal syntheses submission for the first round')), + ('date_solutions_2', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date when solutions of round 2 are available')), + ('date_syntheses_2', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date of maximal syntheses submission for the second round')), + ('final', models.BooleanField(help_text='It should be only one final tournament.', verbose_name='final tournament')), + ('year', models.PositiveIntegerField(default=2020, verbose_name='year')), + ('organizers', models.ManyToManyField(help_text='List of all organizers that can see and manipulate data of the tournament and the teams.', related_name='organized_tournaments', to=settings.AUTH_USER_MODEL, verbose_name='organizers')), + ], + options={ + 'verbose_name': 'tournament', + 'verbose_name_plural': 'tournaments', + }, + ), + 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, verbose_name='name')), + ('trigram', models.CharField(help_text='The trigram should be composed of 3 capitalize letters, that is a funny acronym for the team.', max_length=3, verbose_name='trigram')), + ('inscription_date', models.DateTimeField(auto_now_add=True, verbose_name='inscription date')), + ('validation_status', models.CharField(choices=[('0invalid', 'Registration not validated'), ('1waiting', 'Waiting for validation'), ('2valid', 'Registration validated')], max_length=8, verbose_name='validation status')), + ('selected_for_final', models.BooleanField(default=False, verbose_name='selected for final')), + ('access_code', models.CharField(max_length=6, unique=True, verbose_name='access code')), + ('year', models.PositiveIntegerField(default=2020, verbose_name='year')), + ('tournament', models.ForeignKey(help_text='The tournament where the team is registered.', on_delete=django.db.models.deletion.PROTECT, related_name='_teams', to='tournament.tournament', verbose_name='tournament')), + ], + options={ + 'verbose_name': 'team', + 'verbose_name_plural': 'teams', + 'unique_together': {('name', 'year'), ('trigram', 'year')}, + }, + ), + migrations.CreateModel( + name='Pool', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('round', models.PositiveIntegerField(choices=[(1, 'Round 1'), (2, 'Round 2')], verbose_name='round')), + ('extra_access_token', models.CharField(default='', help_text='Let other users access to the pool data without logging in.', max_length=64, verbose_name='extra access token')), + ('juries', models.ManyToManyField(related_name='pools', to=settings.AUTH_USER_MODEL, verbose_name='juries')), + ('solutions', models.ManyToManyField(related_name='pools', to='member.Solution', verbose_name='solutions')), + ('teams', models.ManyToManyField(related_name='pools', to='tournament.Team', verbose_name='teams')), + ], + options={ + 'verbose_name': 'pool', + 'verbose_name_plural': 'pools', + }, + ), + migrations.CreateModel( + name='Payment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('method', models.CharField(choices=[('not_paid', 'Not paid'), ('credit_card', 'Credit card'), ('check', 'Bank check'), ('transfer', 'Bank transfer'), ('cash', 'Cash'), ('scholarship', 'Scholarship')], default='not_paid', max_length=16, verbose_name='payment method')), + ('validation_status', models.CharField(choices=[('0invalid', 'Registration not validated'), ('1waiting', 'Waiting for validation'), ('2valid', 'Registration validated')], max_length=8, verbose_name='validation status')), + ('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='tournament.team', verbose_name='team')), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payment', to=settings.AUTH_USER_MODEL, verbose_name='user')), + ], + options={ + 'verbose_name': 'payment', + 'verbose_name_plural': 'payments', + }, + ), + ] diff --git a/entrypoint.sh b/entrypoint.sh index 6ed74bf..ffb586e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/sh python manage.py compilemessages -python manage.py makemigrations python manage.py migrate nginx