diff --git a/apps/logs/migrations/0001_initial.py b/apps/logs/migrations/0001_initial.py index 14b9bdf..7cf4361 100644 --- a/apps/logs/migrations/0001_initial.py +++ b/apps/logs/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.11 on 2021-01-21 21:06 +# Generated by Django 3.2.13 on 2023-01-10 19:22 from django.conf import settings from django.db import migrations, models @@ -26,7 +26,7 @@ class Migration(migrations.Migration): ('data', models.TextField(blank=True, default='', verbose_name='new data')), ('action', models.CharField(choices=[('create', 'create'), ('edit', 'edit'), ('delete', 'delete')], default='edit', max_length=16, verbose_name='action')), ('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='timestamp')), - ('model', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.ContentType', verbose_name='model')), + ('model', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype', verbose_name='model')), ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='user')), ], options={ diff --git a/apps/participation/migrations/0001_initial.py b/apps/participation/migrations/0001_initial.py index 3eb3749..30dc01a 100644 --- a/apps/participation/migrations/0001_initial.py +++ b/apps/participation/migrations/0001_initial.py @@ -1,8 +1,9 @@ -# Generated by Django 3.0.11 on 2021-01-22 18:26 +# Generated by Django 3.2.13 on 2023-01-10 19:22 import datetime import django.core.validators from django.db import migrations, models +import django.db.models.deletion import django.utils.timezone import participation.models @@ -47,8 +48,8 @@ class Migration(migrations.Migration): name='Passage', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('place', models.CharField(default='Non indiqué', help_text='Where the solution is presented?', max_length=255, verbose_name='place')), ('solution_number', models.PositiveSmallIntegerField(choices=[(1, 'Problem #1'), (2, 'Problem #2'), (3, 'Problem #3'), (4, 'Problem #4'), (5, 'Problem #5'), (6, 'Problem #6'), (7, 'Problem #7'), (8, 'Problem #8')], verbose_name='defended solution')), + ('defender_penalties', models.PositiveSmallIntegerField(default=0, help_text='Number of penalties for the defender. The defender will loose a 0.5 coefficient per penalty.', verbose_name='penalties')), ], options={ 'verbose_name': 'passage', @@ -61,6 +62,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('round', models.PositiveSmallIntegerField(choices=[(1, 'Round 1'), (2, 'Round 2')], verbose_name='round')), ('bbb_url', models.CharField(blank=True, default='', help_text='The link of the BBB visio for this pool.', max_length=255, verbose_name='BigBlueButton URL')), + ('results_available', models.BooleanField(default=False, help_text='Check this case when results become accessible to teams. They stay accessible to you. Only averages are given.', verbose_name='results available')), ], options={ 'verbose_name': 'pool', @@ -73,11 +75,12 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('problem', models.PositiveSmallIntegerField(choices=[(1, 'Problem #1'), (2, 'Problem #2'), (3, 'Problem #3'), (4, 'Problem #4'), (5, 'Problem #5'), (6, 'Problem #6'), (7, 'Problem #7'), (8, 'Problem #8')], verbose_name='problem')), ('final_solution', models.BooleanField(default=False, verbose_name='solution for the final tournament')), - ('file', models.FileField(blank=True, default='', unique=True, upload_to=participation.models.get_solution_filename, verbose_name='file')), + ('file', models.FileField(unique=True, upload_to=participation.models.get_solution_filename, verbose_name='file')), ], options={ 'verbose_name': 'solution', 'verbose_name_plural': 'solutions', + 'ordering': ('participation__team__trigram', 'final_solution', 'problem'), }, ), migrations.CreateModel( @@ -85,11 +88,12 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('type', models.PositiveSmallIntegerField(choices=[(1, 'opponent'), (2, 'reporter')])), - ('file', models.FileField(blank=True, default='', unique=True, upload_to=participation.models.get_synthesis_filename, verbose_name='file')), + ('file', models.FileField(unique=True, upload_to=participation.models.get_synthesis_filename, verbose_name='file')), ], options={ 'verbose_name': 'synthesis', 'verbose_name_plural': 'syntheses', + 'ordering': ('passage__pool__round', 'type'), }, ), migrations.CreateModel( @@ -113,8 +117,10 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=255, unique=True, verbose_name='name')), ('date_start', models.DateField(default=datetime.date.today, verbose_name='start')), ('date_end', models.DateField(default=datetime.date.today, verbose_name='end')), + ('place', models.CharField(max_length=255, verbose_name='place')), ('max_teams', models.PositiveSmallIntegerField(default=9, verbose_name='max team count')), ('price', models.PositiveSmallIntegerField(default=21, verbose_name='price')), + ('remote', models.BooleanField(default=False, verbose_name='remote')), ('inscription_limit', models.DateTimeField(default=django.utils.timezone.now, verbose_name='limit date for registrations')), ('solution_limit', models.DateTimeField(default=django.utils.timezone.now, verbose_name='limit date to upload solutions')), ('solutions_draw', models.DateTimeField(default=django.utils.timezone.now, verbose_name='random draw for solutions')), @@ -129,4 +135,17 @@ class Migration(migrations.Migration): 'verbose_name_plural': 'tournaments', }, ), + migrations.CreateModel( + name='Tweak', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('diff', models.IntegerField(help_text='Score to add/remove on the final score', verbose_name='difference')), + ('participation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tweaks', to='participation.participation', verbose_name='participation')), + ('pool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='participation.pool', verbose_name='passage')), + ], + options={ + 'verbose_name': 'tweak', + 'verbose_name_plural': 'tweaks', + }, + ), ] diff --git a/apps/participation/migrations/0002_auto_20210122_1926.py b/apps/participation/migrations/0002_auto_20210122_1926.py deleted file mode 100644 index ac72117..0000000 --- a/apps/participation/migrations/0002_auto_20210122_1926.py +++ /dev/null @@ -1,115 +0,0 @@ -# Generated by Django 3.0.11 on 2021-01-22 18:26 - -import address.models -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('registration', '0001_initial'), - ('address', '0003_auto_20200830_1851'), - ('participation', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='tournament', - name='organizers', - field=models.ManyToManyField(related_name='organized_tournaments', to='registration.VolunteerRegistration', verbose_name='organizers'), - ), - migrations.AddField( - model_name='tournament', - name='place', - field=address.models.AddressField(on_delete=django.db.models.deletion.CASCADE, to='address.Address', verbose_name='place'), - ), - migrations.AddIndex( - model_name='team', - index=models.Index(fields=['trigram'], name='participati_trigram_239255_idx'), - ), - migrations.AddField( - model_name='synthesis', - name='participation', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='participation.Participation', verbose_name='participation'), - ), - migrations.AddField( - model_name='synthesis', - name='passage', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='syntheses', to='participation.Passage', verbose_name='passage'), - ), - migrations.AddField( - model_name='solution', - name='participation', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='solutions', to='participation.Participation', verbose_name='participation'), - ), - migrations.AddField( - model_name='pool', - name='juries', - field=models.ManyToManyField(related_name='jury_in', to='registration.VolunteerRegistration', verbose_name='juries'), - ), - migrations.AddField( - model_name='pool', - name='participations', - field=models.ManyToManyField(related_name='pools', to='participation.Participation', verbose_name='participations'), - ), - migrations.AddField( - model_name='pool', - name='tournament', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pools', to='participation.Tournament', verbose_name='tournament'), - ), - migrations.AddField( - model_name='passage', - name='defender', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='participation.Participation', verbose_name='defender'), - ), - migrations.AddField( - model_name='passage', - name='opponent', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='participation.Participation', verbose_name='opponent'), - ), - migrations.AddField( - model_name='passage', - name='pool', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='passages', to='participation.Pool', verbose_name='pool'), - ), - migrations.AddField( - model_name='passage', - name='reporter', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='participation.Participation', verbose_name='reporter'), - ), - migrations.AddField( - model_name='participation', - name='team', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='participation.Team', verbose_name='team'), - ), - migrations.AddField( - model_name='participation', - name='tournament', - field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='participation.Tournament', verbose_name='tournament'), - ), - migrations.AddField( - model_name='note', - name='jury', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='registration.VolunteerRegistration', verbose_name='jury'), - ), - migrations.AddField( - model_name='note', - name='passage', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='participation.Passage', verbose_name='passage'), - ), - migrations.AddIndex( - model_name='tournament', - index=models.Index(fields=['name', 'date_start', 'date_end'], name='participati_name_b43174_idx'), - ), - migrations.AlterUniqueTogether( - name='synthesis', - unique_together={('participation', 'passage', 'type')}, - ), - migrations.AlterUniqueTogether( - name='solution', - unique_together={('participation', 'problem', 'final_solution')}, - ), - ] diff --git a/apps/participation/migrations/0003_tournament_remote.py b/apps/participation/migrations/0003_tournament_remote.py deleted file mode 100644 index 1dca7a5..0000000 --- a/apps/participation/migrations/0003_tournament_remote.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.11 on 2021-01-23 18:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0002_auto_20210122_1926'), - ] - - operations = [ - migrations.AddField( - model_name='tournament', - name='remote', - field=models.BooleanField(default=False, verbose_name='remote'), - ), - ] diff --git a/apps/participation/migrations/0004_passage_defender_penalties.py b/apps/participation/migrations/0004_passage_defender_penalties.py deleted file mode 100644 index 0738a3c..0000000 --- a/apps/participation/migrations/0004_passage_defender_penalties.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.7 on 2021-04-03 19:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0003_tournament_remote'), - ] - - operations = [ - migrations.AddField( - model_name='passage', - name='defender_penalties', - field=models.PositiveSmallIntegerField(default=0, help_text='Number of penalties for the defender. The defender will loose a 0.5 coefficient per penalty.', verbose_name='penalties'), - ), - ] diff --git a/apps/participation/migrations/0005_pool_results_available.py b/apps/participation/migrations/0005_pool_results_available.py deleted file mode 100644 index 314edca..0000000 --- a/apps/participation/migrations/0005_pool_results_available.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.7 on 2021-04-10 07:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0004_passage_defender_penalties'), - ] - - operations = [ - migrations.AddField( - model_name='pool', - name='results_available', - field=models.BooleanField(default=False, help_text='Check this case when results become accessible to teams. They stay accessible to you. Only averages are given.', verbose_name='results available'), - ), - ] diff --git a/apps/participation/migrations/0006_auto_20220426_1346.py b/apps/participation/migrations/0006_auto_20220426_1346.py deleted file mode 100644 index ed6d315..0000000 --- a/apps/participation/migrations/0006_auto_20220426_1346.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 3.2.13 on 2022-04-26 11:46 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0005_pool_results_available'), - ] - - operations = [ - migrations.AlterModelOptions( - name='solution', - options={'ordering': ('participation__team__trigram', 'final_solution', 'problem'), 'verbose_name': 'solution', 'verbose_name_plural': 'solutions'}, - ), - migrations.AlterModelOptions( - name='synthesis', - options={'ordering': ('passage__pool__round', 'type'), 'verbose_name': 'synthesis', 'verbose_name_plural': 'syntheses'}, - ), - ] diff --git a/apps/participation/migrations/0007_remove_passage_place.py b/apps/participation/migrations/0007_remove_passage_place.py deleted file mode 100644 index b1810b1..0000000 --- a/apps/participation/migrations/0007_remove_passage_place.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.2.13 on 2022-04-26 19:42 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0006_auto_20220426_1346'), - ] - - operations = [ - migrations.RemoveField( - model_name='passage', - name='place', - ), - ] diff --git a/apps/participation/migrations/0008_auto_20220429_1853.py b/apps/participation/migrations/0008_auto_20220429_1853.py deleted file mode 100644 index c3974a3..0000000 --- a/apps/participation/migrations/0008_auto_20220429_1853.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 3.2.13 on 2022-04-29 16:53 - -from django.db import migrations, models -import participation.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0007_remove_passage_place'), - ] - - operations = [ - migrations.AlterField( - model_name='solution', - name='file', - field=models.FileField(unique=True, upload_to=participation.models.get_solution_filename, verbose_name='file'), - ), - migrations.AlterField( - model_name='synthesis', - name='file', - field=models.FileField(unique=True, upload_to=participation.models.get_synthesis_filename, verbose_name='file'), - ), - ] diff --git a/apps/participation/migrations/0009_tweak.py b/apps/participation/migrations/0009_tweak.py deleted file mode 100644 index 025a03d..0000000 --- a/apps/participation/migrations/0009_tweak.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 3.2.13 on 2022-05-15 14:40 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('participation', '0008_auto_20220429_1853'), - ] - - operations = [ - migrations.CreateModel( - name='Tweak', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('diff', models.IntegerField(help_text='Score to add/remove on the final score', verbose_name='difference')), - ('participation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tweaks', to='participation.participation', verbose_name='participation')), - ('pool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='participation.pool', verbose_name='passage')), - ], - options={ - 'verbose_name': 'tweak', - 'verbose_name_plural': 'tweaks', - }, - ), - ] diff --git a/apps/participation/models.py b/apps/participation/models.py index 47e6206..04b498b 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -4,7 +4,6 @@ from datetime import date import os -from address.models import AddressField from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import RegexValidator @@ -143,7 +142,8 @@ class Tournament(models.Model): default=date.today, ) - place = AddressField( + place = models.CharField( + max_length=255, verbose_name=_("place"), ) diff --git a/apps/registration/migrations/0001_initial.py b/apps/registration/migrations/0001_initial.py index f636a10..001c850 100644 --- a/apps/registration/migrations/0001_initial.py +++ b/apps/registration/migrations/0001_initial.py @@ -1,8 +1,8 @@ -# Generated by Django 3.0.11 on 2021-01-22 18:26 +# Generated by Django 3.2.13 on 2023-01-10 19:22 -import address.models import datetime from django.conf import settings +import django.core.validators from django.db import migrations, models import django.db.models.deletion import phonenumber_field.modelfields @@ -14,10 +14,9 @@ class Migration(migrations.Migration): initial = True dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('contenttypes', '0002_remove_content_type_name'), - ('address', '0003_auto_20200830_1851'), ('participation', '0001_initial'), + ('contenttypes', '0002_remove_content_type_name'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -27,7 +26,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('give_contact_to_animath', models.BooleanField(default=False, verbose_name='Grant Animath to contact me in the future about other actions')), ('email_confirmed', models.BooleanField(default=False, verbose_name='email confirmed')), - ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_registration.registration_set+', to='contenttypes.ContentType')), + ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_registration.registration_set+', to='contenttypes.contenttype')), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')), ], options={ @@ -38,13 +37,16 @@ class Migration(migrations.Migration): migrations.CreateModel( name='ParticipantRegistration', fields=[ - ('registration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.Registration')), + ('registration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.registration')), ('birth_date', models.DateField(default=datetime.date.today, verbose_name='birth date')), ('gender', models.CharField(choices=[('female', 'Female'), ('male', 'Male'), ('other', 'Other')], default='other', max_length=6, verbose_name='gender')), + ('address', models.CharField(max_length=255, verbose_name='address')), + ('zip_code', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1000), django.core.validators.MaxValueValidator(99999)], verbose_name='zip code')), + ('city', models.CharField(max_length=255, verbose_name='city')), ('phone_number', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, verbose_name='phone number')), + ('health_issues', models.TextField(blank=True, help_text='You can indicate here your allergies or anything that is important to know for organizers', verbose_name='health issues')), ('photo_authorization', models.FileField(blank=True, default='', upload_to=registration.models.get_random_photo_filename, verbose_name='photo authorization')), - ('address', address.models.AddressField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='address.Address', verbose_name='address')), - ('team', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='participants', to='participation.Team', verbose_name='team')), + ('team', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='participants', to='participation.team', verbose_name='team')), ], options={ 'abstract': False, @@ -55,7 +57,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='VolunteerRegistration', fields=[ - ('registration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.Registration')), + ('registration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.registration')), ('professional_activity', models.TextField(verbose_name='professional activity')), ], options={ @@ -67,7 +69,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='AdminRegistration', fields=[ - ('volunteerregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.VolunteerRegistration')), + ('volunteerregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.volunteerregistration')), ('role', models.TextField(verbose_name='role of the administrator')), ], options={ @@ -79,7 +81,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='CoachRegistration', fields=[ - ('participantregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.ParticipantRegistration')), + ('participantregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.participantregistration')), ('professional_activity', models.TextField(verbose_name='professional activity')), ], options={ @@ -91,7 +93,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='StudentRegistration', fields=[ - ('participantregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.ParticipantRegistration')), + ('participantregistration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.participantregistration')), ('student_class', models.IntegerField(choices=[(12, '12th grade'), (11, '11th grade'), (10, '10th grade or lower')], verbose_name='student class')), ('school', models.CharField(max_length=255, verbose_name='school')), ('responsible_name', models.CharField(default='', max_length=255, verbose_name='responsible name')), @@ -110,11 +112,11 @@ class Migration(migrations.Migration): name='Payment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('type', models.CharField(blank=True, choices=[('', 'No payment'), ('helloasso', 'Hello Asso'), ('scholarship', 'Scholarship'), ('bank_transfer', 'Bank transfer'), ('free', 'The tournament is free')], default='', max_length=16, verbose_name='type')), + ('type', models.CharField(blank=True, choices=[('', 'No payment'), ('helloasso', 'Hello Asso'), ('scholarship', 'Scholarship'), ('bank_transfer', 'Bank transfer'), ('other', 'Other (please indicate)'), ('free', 'The tournament is free')], default='', max_length=16, verbose_name='type')), ('scholarship_file', models.FileField(blank=True, default='', help_text='only if you have a scholarship.', upload_to=registration.models.get_scholarship_filename, verbose_name='scholarship file')), ('additional_information', models.TextField(blank=True, default='', help_text='To help us to find your payment.', verbose_name='additional information')), ('valid', models.BooleanField(default=False, null=True, verbose_name='valid')), - ('registration', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payment', to='registration.ParticipantRegistration', verbose_name='registration')), + ('registration', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payment', to='registration.participantregistration', verbose_name='registration')), ], options={ 'verbose_name': 'payment', diff --git a/apps/registration/migrations/0002_participantregistration_health_issues.py b/apps/registration/migrations/0002_participantregistration_health_issues.py deleted file mode 100644 index e50b992..0000000 --- a/apps/registration/migrations/0002_participantregistration_health_issues.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.11 on 2021-01-23 20:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('registration', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='participantregistration', - name='health_issues', - field=models.TextField(blank=True, help_text='You can indicate here your allergies or anything that is important to know for organizers', verbose_name='health issues'), - ), - ] diff --git a/apps/registration/migrations/0003_alter_payment_type.py b/apps/registration/migrations/0003_alter_payment_type.py deleted file mode 100644 index 7def9e0..0000000 --- a/apps/registration/migrations/0003_alter_payment_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.13 on 2022-04-26 11:46 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('registration', '0002_participantregistration_health_issues'), - ] - - operations = [ - migrations.AlterField( - model_name='payment', - name='type', - field=models.CharField(blank=True, choices=[('', 'No payment'), ('helloasso', 'Hello Asso'), ('scholarship', 'Scholarship'), ('bank_transfer', 'Bank transfer'), ('other', 'Other (please indicate)'), ('free', 'The tournament is free')], default='', max_length=16, verbose_name='type'), - ), - ] diff --git a/apps/registration/models.py b/apps/registration/models.py index d5fd812..f8b35d6 100644 --- a/apps/registration/models.py +++ b/apps/registration/models.py @@ -3,8 +3,8 @@ from datetime import date -from address.models import AddressField from django.contrib.sites.models import Site +from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.template import loader from django.urls import reverse_lazy @@ -139,10 +139,19 @@ class ParticipantRegistration(Registration): default="other", ) - address = AddressField( + address = models.CharField( + max_length=255, verbose_name=_("address"), - null=True, - default=None, + ) + + zip_code = models.PositiveSmallIntegerField( + verbose_name=_("zip code"), + validators=[MinValueValidator(1000), MaxValueValidator(99999)], + ) + + city = models.CharField( + max_length=255, + verbose_name=_("city"), ) phone_number = PhoneNumberField( diff --git a/apps/registration/templates/registration/user_detail.html b/apps/registration/templates/registration/user_detail.html index 757c15e..b64080a 100644 --- a/apps/registration/templates/registration/user_detail.html +++ b/apps/registration/templates/registration/user_detail.html @@ -46,7 +46,7 @@