Skip to content
Snippets Groups Projects
Commit eacd5721 authored by salazard's avatar salazard
Browse files

add date pf birth as field in registration

parent 90743fe0
No related branches found
No related tags found
1 merge request!61Verification mail
# Generated by Django 2.2 on 2022-09-09 15:40
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0017_student_qpv'),
]
operations = [
migrations.AddField(
model_name='student',
name='dateOfBirth',
field=models.DateField(default=datetime.date(2000, 1, 1)),
preserve_default=False,
),
migrations.AlterField(
model_name='tutor',
name='promotion',
field=models.IntegerField(choices=[(2025, '2025'), (2024, '2024'), (2023, '2023'), (2022, '2022'), (2021, '2021')], default=2025),
),
]
......@@ -31,11 +31,10 @@ class StudentSerializer(serializers.HyperlinkedModelSerializer):
read_only=True)
registration = StudentRegistrationSerializer()
class Meta: # noqa
model = Student
fields = (
'user_id', 'user', 'url', 'registration', 'visits', 'gender', 'addressNumber', 'street', 'city', 'personalPhone', 'parentsPhone', 'parentsEmail', 'school', 'grade', 'scholarship', 'fatherActivity', 'motherActivity', 'parentsStatus', 'dependantsNumber', 'specialTeaching', 'nationality', 'zipCode', 'classType', 'year')
'user_id', 'user', 'url', 'registration', 'visits', 'gender', 'addressNumber', 'street', 'city', 'personalPhone', 'parentsPhone', 'parentsEmail', 'school', 'grade', 'scholarship', 'fatherActivity', 'motherActivity', 'parentsStatus', 'dependantsNumber', 'specialTeaching', 'nationality', 'zipCode', 'classType', 'year', 'dateOfBirth')
extra_kwargs = {
'url': {'view_name': 'api:student-detail'},
}
# Generated by Django 2.2 on 2022-09-09 15:40
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('register', '0002_registration_phone_number'),
]
operations = [
migrations.AddField(
model_name='registration',
name='dateOfBirth',
field=models.DateField(default=datetime.date(1997, 10, 19)),
preserve_default=False,
),
]
......@@ -24,7 +24,7 @@ class RegistrationSerializer(serializers.ModelSerializer):
model = Registration
fields = ('id', 'email', 'password',
'first_name', 'last_name', 'phone_number',
'submitted', 'validated',)
'submitted', 'validated', 'dateOfBirth')
extra_kwargs = {
'submitted': {'read_only': True},
......@@ -43,6 +43,7 @@ class RegistrationSerializer(serializers.ModelSerializer):
- Build/save the nested objects (address, emergency contact)
- Build/save a user and a student profile
"""
password = validated_data.pop('password')
registration = Registration.objects.create(**validated_data)
......
......@@ -27,5 +27,6 @@ def create_user_and_student(sender, instance: Registration,
Student.objects.create(
user=user,
dateOfBirth=instance.dateOfBirth,
registration=instance,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment