plateforme-tfjm2/apps/tournament/migrations/0001_initial.py

93 lines
6.4 KiB
Python

# 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',
},
),
]