From e4f1aba7025e2752b6e1a0aeb9584044184ddefe Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Thu, 3 Sep 2020 18:28:54 +0200 Subject: add missing field to personal data --- client/migrations/0004_auto_20200903_1828.py | 23 +++++++++++++++++++++++ client/models.py | 2 ++ client/views.py | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 client/migrations/0004_auto_20200903_1828.py diff --git a/client/migrations/0004_auto_20200903_1828.py b/client/migrations/0004_auto_20200903_1828.py new file mode 100644 index 0000000..4121ca5 --- /dev/null +++ b/client/migrations/0004_auto_20200903_1828.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.7 on 2020-09-03 16:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0003_auto_20200731_1035'), + ] + + operations = [ + migrations.AddField( + model_name='personaldata', + name='school', + field=models.CharField(default='', max_length=250), + ), + migrations.AddField( + model_name='personaldata', + name='year', + field=models.IntegerField(default=0), + ), + ] diff --git a/client/models.py b/client/models.py index dd5d998..c85ca14 100644 --- a/client/models.py +++ b/client/models.py @@ -29,6 +29,8 @@ class PersonalData(models.Model): home_phone = models.CharField(default="", max_length=250) phone = models.CharField(default="", max_length=250) email = models.CharField(default="", max_length=250) + school = models.CharField(default="", max_length=250) + year = models.IntegerField(default=0) class MedicalData(models.Model): diff --git a/client/views.py b/client/views.py index a0143a2..4bc7e0e 100644 --- a/client/views.py +++ b/client/views.py @@ -196,7 +196,7 @@ def create(request): # copy personal data and medical data if document_type.personal_data: personal_data = PersonalData(email=request.user.email, parent_name=usercode.parent_name, via=usercode.via, cap=usercode.cap, country=usercode.country, - nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone) + nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone, school=usercode.school, year=usercode.year) personal_data.save() if document_type.medical_data: @@ -252,7 +252,7 @@ def edit_wrapper(request, context): if document.document_type.personal_data: personal_data = PersonalData(email=request.user.email, parent_name=usercode.parent_name, via=usercode.via, cap=usercode.cap, country=usercode.country, - nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone) + nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone, school=usercode.school, year=usercode.year) personal_data.save() old_data = document.personal_data document.personal_data = personal_data -- cgit v1.2.1