mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 02:16:16 +00:00
jira-13 update country name
This commit is contained in:
18
guardian/migrations/0003_guardian_country_name.py
Normal file
18
guardian/migrations/0003_guardian_country_name.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.2 on 2023-06-27 13:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('guardian', '0002_remove_guardian_junior_code'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='guardian',
|
||||||
|
name='country_name',
|
||||||
|
field=models.CharField(blank=True, default=None, max_length=30, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -13,6 +13,7 @@ class Guardian(models.Model):
|
|||||||
"""Contact details"""
|
"""Contact details"""
|
||||||
country_code = models.IntegerField(blank=True, null=True)
|
country_code = models.IntegerField(blank=True, null=True)
|
||||||
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
|
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
|
||||||
|
country_name = models.CharField(max_length=30, null=True, blank=True, default=None)
|
||||||
"""Personal info"""
|
"""Personal info"""
|
||||||
family_name = models.CharField(max_length=50, null=True, blank=True, default=None)
|
family_name = models.CharField(max_length=50, null=True, blank=True, default=None)
|
||||||
gender = models.CharField(choices=GENDERS, max_length=15, null=True, blank=True, default=None)
|
gender = models.CharField(choices=GENDERS, max_length=15, null=True, blank=True, default=None)
|
||||||
|
@ -99,6 +99,7 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
|
|||||||
guardian.phone = validated_data.get('phone', guardian.phone)
|
guardian.phone = validated_data.get('phone', guardian.phone)
|
||||||
guardian.country_code = validated_data.get('country_code', guardian.country_code)
|
guardian.country_code = validated_data.get('country_code', guardian.country_code)
|
||||||
guardian.passcode = validated_data.get('passcode', guardian.passcode)
|
guardian.passcode = validated_data.get('passcode', guardian.passcode)
|
||||||
|
guardian.country_name = validated_data.get('country_name', guardian.country_name)
|
||||||
guardian.referral_code_used = validated_data.get('referral_code_used', guardian.referral_code_used)
|
guardian.referral_code_used = validated_data.get('referral_code_used', guardian.referral_code_used)
|
||||||
"""Complete profile of the junior if below all data are filled"""
|
"""Complete profile of the junior if below all data are filled"""
|
||||||
complete_profile_field = all([guardian.phone, guardian.gender, guardian.family_name,
|
complete_profile_field = all([guardian.phone, guardian.gender, guardian.family_name,
|
||||||
|
18
junior/migrations/0002_junior_country_name.py
Normal file
18
junior/migrations/0002_junior_country_name.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.2 on 2023-06-27 13:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('junior', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='junior',
|
||||||
|
name='country_name',
|
||||||
|
field=models.CharField(blank=True, default=None, max_length=30, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -14,6 +14,7 @@ class Junior(models.Model):
|
|||||||
"""Contact details"""
|
"""Contact details"""
|
||||||
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
|
phone = models.CharField(max_length=31, null=True, blank=True, default=None)
|
||||||
country_code = models.IntegerField(blank=True, null=True)
|
country_code = models.IntegerField(blank=True, null=True)
|
||||||
|
country_name = models.CharField(max_length=30, null=True, blank=True, default=None)
|
||||||
"""Personal info"""
|
"""Personal info"""
|
||||||
gender = models.CharField(max_length=10, choices=GENDERS, null=True, blank=True, default=None)
|
gender = models.CharField(max_length=10, choices=GENDERS, null=True, blank=True, default=None)
|
||||||
dob = models.DateField(max_length=15, null=True, blank=True, default=None)
|
dob = models.DateField(max_length=15, null=True, blank=True, default=None)
|
||||||
|
@ -72,6 +72,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
|
|||||||
junior.guardian_code = validated_data.get('guardian_code', junior.guardian_code)
|
junior.guardian_code = validated_data.get('guardian_code', junior.guardian_code)
|
||||||
junior.dob = validated_data.get('dob',junior.dob)
|
junior.dob = validated_data.get('dob',junior.dob)
|
||||||
junior.passcode = validated_data.get('passcode', junior.passcode)
|
junior.passcode = validated_data.get('passcode', junior.passcode)
|
||||||
|
junior.country_name = validated_data.get('country_name', junior.country_name)
|
||||||
"""Update country code and phone number"""
|
"""Update country code and phone number"""
|
||||||
junior.phone = validated_data.get('phone', junior.phone)
|
junior.phone = validated_data.get('phone', junior.phone)
|
||||||
junior.country_code = validated_data.get('country_code', junior.country_code)
|
junior.country_code = validated_data.get('country_code', junior.country_code)
|
||||||
|
Reference in New Issue
Block a user