mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-22 01:18:27 +02:00
Birth date is only for participants
This commit is contained in:
@ -101,8 +101,8 @@ class StudentRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
class Meta:
|
||||
model = StudentRegistration
|
||||
fields = ('team', 'student_class', 'birth_date', 'gender', 'address', 'phone_number', 'health_issues',
|
||||
'school', 'responsible_name', 'responsible_phone', 'responsible_email',
|
||||
fields = ('team', 'student_class', 'birth_date', 'gender', 'address', 'zip_code', 'city', 'phone_number',
|
||||
'health_issues', 'school', 'responsible_name', 'responsible_phone', 'responsible_email',
|
||||
'give_contact_to_animath', 'email_confirmed',)
|
||||
|
||||
|
||||
@ -178,8 +178,8 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
class Meta:
|
||||
model = CoachRegistration
|
||||
fields = ('team', 'birth_date', 'gender', 'address', 'phone_number', 'health_issues', 'professional_activity',
|
||||
'give_contact_to_animath', 'email_confirmed',)
|
||||
fields = ('team', 'gender', 'address', 'zip_code', 'city', 'phone_number', 'health_issues',
|
||||
'professional_activity', 'give_contact_to_animath', 'email_confirmed',)
|
||||
|
||||
|
||||
class VolunteerRegistrationForm(forms.ModelForm):
|
||||
|
29
apps/registration/migrations/0002_auto_20230110_2031.py
Normal file
29
apps/registration/migrations/0002_auto_20230110_2031.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Generated by Django 3.2.13 on 2023-01-10 19:31
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
import phonenumber_field.modelfields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('registration', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='participantregistration',
|
||||
name='birth_date',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='studentregistration',
|
||||
name='birth_date',
|
||||
field=models.DateField(default=datetime.date.today, verbose_name='birth date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='studentregistration',
|
||||
name='responsible_phone',
|
||||
field=phonenumber_field.modelfields.PhoneNumberField(default='', max_length=128, region=None, verbose_name='responsible phone number'),
|
||||
),
|
||||
]
|
@ -123,11 +123,6 @@ class ParticipantRegistration(Registration):
|
||||
verbose_name=_("team"),
|
||||
)
|
||||
|
||||
birth_date = models.DateField(
|
||||
verbose_name=_("birth date"),
|
||||
default=date.today,
|
||||
)
|
||||
|
||||
gender = models.CharField(
|
||||
max_length=6,
|
||||
verbose_name=_("gender"),
|
||||
@ -174,6 +169,8 @@ class ParticipantRegistration(Registration):
|
||||
|
||||
@property
|
||||
def under_18(self):
|
||||
if isinstance(self, CoachRegistration):
|
||||
return False # In normal case
|
||||
important_date = timezone.now().date()
|
||||
if self.team and self.team.participation.tournament:
|
||||
important_date = self.team.participation.tournament.date_start
|
||||
@ -196,6 +193,11 @@ class StudentRegistration(ParticipantRegistration):
|
||||
Specific registration for students.
|
||||
They have a team, a student class and a school.
|
||||
"""
|
||||
birth_date = models.DateField(
|
||||
verbose_name=_("birth date"),
|
||||
default=date.today,
|
||||
)
|
||||
|
||||
student_class = models.IntegerField(
|
||||
choices=[
|
||||
(12, _("12th grade")),
|
||||
@ -218,7 +220,7 @@ class StudentRegistration(ParticipantRegistration):
|
||||
|
||||
responsible_phone = PhoneNumberField(
|
||||
verbose_name=_("responsible phone number"),
|
||||
blank=True,
|
||||
default="",
|
||||
)
|
||||
|
||||
responsible_email = models.EmailField(
|
||||
|
@ -39,8 +39,10 @@
|
||||
</a>
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-6 text-right">{% trans "Birth date:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.birth_date }}</dd>
|
||||
{% if user_object.registration.studentregistration %}
|
||||
<dt class="col-sm-6 text-right">{% trans "Birth date:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.birth_date }}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt class="col-sm-6 text-right">{% trans "Gender:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.get_gender_display }}</dd>
|
||||
|
@ -3,8 +3,9 @@
|
||||
{{ object.user.email }}
|
||||
{{ object.type }}
|
||||
{{ object.professional_activity }}
|
||||
{{ object.birth_date }}
|
||||
{{ object.address }}
|
||||
{{ object.zip_code }}
|
||||
{{ object.city }}
|
||||
{{ object.phone_number }}
|
||||
{{ object.team.name }}
|
||||
{{ object.team.trigram }}
|
||||
|
@ -6,6 +6,8 @@
|
||||
{{ object.school }}
|
||||
{{ object.birth_date }}
|
||||
{{ object.address }}
|
||||
{{ object.zip_code }}
|
||||
{{ object.city }}
|
||||
{{ object.phone_number }}
|
||||
{{ object.responsible_name }}
|
||||
{{ object.reponsible_phone }}
|
||||
|
@ -178,7 +178,6 @@ class TestRegistration(TestCase):
|
||||
password1="azertyuiopazertyuiop",
|
||||
password2="azertyuiopazertyuiop",
|
||||
role="coach",
|
||||
birth_date="1980-01-01",
|
||||
gender="other",
|
||||
address="1 Rue de Rivoli",
|
||||
zip_code=75001,
|
||||
@ -264,8 +263,8 @@ class TestRegistration(TestCase):
|
||||
gender="female", address="1 Rue de Rivoli", zip_code=75001,
|
||||
city="Paris", responsible_name="Toto",
|
||||
responsible_email="toto@example.com")),
|
||||
(self.coach, dict(professional_activity="God", birth_date="2001-01-01",
|
||||
gender="male", address="1 Rue de Rivoli", zip_code=75001, city="Paris"))]:
|
||||
(self.coach, dict(professional_activity="God", gender="male",
|
||||
address="1 Rue de Rivoli", zip_code=75001, city="Paris"))]:
|
||||
response = self.client.get(reverse("registration:update_user", args=(user.pk,)))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
Reference in New Issue
Block a user