From 8cb645eb1125db9887360d32d9440a9ca8a1ae4d Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sun, 20 Jun 2021 12:29:39 +0200 Subject: add avs number to form --- client/migrations/0007_personaldata_avs_number.py | 18 ++++++++++++++++++ client/migrations/0008_usercode_avs_number.py | 18 ++++++++++++++++++ client/models.py | 2 ++ client/templates/client/index.html | 6 +++++- client/views.py | 4 ++-- 5 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 client/migrations/0007_personaldata_avs_number.py create mode 100644 client/migrations/0008_usercode_avs_number.py (limited to 'client') diff --git a/client/migrations/0007_personaldata_avs_number.py b/client/migrations/0007_personaldata_avs_number.py new file mode 100644 index 0000000..cd2a67c --- /dev/null +++ b/client/migrations/0007_personaldata_avs_number.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.4 on 2021-06-20 10:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0006_documenttype_max_instances'), + ] + + operations = [ + migrations.AddField( + model_name='personaldata', + name='avs_number', + field=models.CharField(default='', max_length=250), + ), + ] diff --git a/client/migrations/0008_usercode_avs_number.py b/client/migrations/0008_usercode_avs_number.py new file mode 100644 index 0000000..365aaad --- /dev/null +++ b/client/migrations/0008_usercode_avs_number.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.4 on 2021-06-20 10:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0007_personaldata_avs_number'), + ] + + operations = [ + migrations.AddField( + model_name='usercode', + name='avs_number', + field=models.CharField(default='', max_length=250), + ), + ] diff --git a/client/models.py b/client/models.py index d14a267..3d4e63d 100644 --- a/client/models.py +++ b/client/models.py @@ -33,6 +33,7 @@ class PersonalData(models.Model): email = models.CharField(default="", max_length=250) school = models.CharField(default="", max_length=250) year = models.IntegerField(default=0) + avs_number = models.CharField(default="", max_length=250) class MedicalData(models.Model): @@ -111,3 +112,4 @@ class UserCode(models.Model): phone = models.CharField(default="", max_length=250) school = models.CharField(default="", max_length=250) year = models.IntegerField(default=0) + avs_number = models.CharField(default="", max_length=250) \ No newline at end of file diff --git a/client/templates/client/index.html b/client/templates/client/index.html index 932af1c..7f0edec 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -109,10 +109,14 @@ -
+
+
+ + +
diff --git a/client/views.py b/client/views.py index 32678f5..6f8efb3 100644 --- a/client/views.py +++ b/client/views.py @@ -221,7 +221,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, school=usercode.school, year=usercode.year) + nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone, school=usercode.school, year=usercode.year, avs_number=usercode.avs_number) personal_data.save() if document_type.medical_data: @@ -281,7 +281,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, school=usercode.school, year=usercode.year) + nationality=usercode.nationality, born_date=usercode.born_date, home_phone=usercode.home_phone, phone=usercode.phone, school=usercode.school, year=usercode.year, avs_number=usercode.avs_number) personal_data.save() old_data = document.personal_data document.personal_data = personal_data -- cgit v1.2.1