From 245162b913b23673baeb00cfc6985baaf3c8e0e5 Mon Sep 17 00:00:00 2001 From: jain Date: Fri, 30 Jun 2023 15:51:12 +0530 Subject: [PATCH 1/3] jira-274 user can use same number multiple time --- guardian/serializers.py | 10 +++++----- junior/serializers.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guardian/serializers.py b/guardian/serializers.py index a896e62..ba72ef5 100644 --- a/guardian/serializers.py +++ b/guardian/serializers.py @@ -86,11 +86,11 @@ class CreateGuardianSerializer(serializers.ModelSerializer): def create(self, validated_data): """Create guardian profile""" - phone_number = validated_data.get('phone', None) - guardian_data = Guardian.objects.filter(phone=phone_number) - junior_data = Junior.objects.filter(phone=phone_number) - if phone_number and (guardian_data or junior_data): - raise serializers.ValidationError({"details": ERROR_CODE['2012']}) + # phone_number = validated_data.get('phone', None) + # guardian_data = Guardian.objects.filter(phone=phone_number) + # junior_data = Junior.objects.filter(phone=phone_number) + # if phone_number and (guardian_data or junior_data): + # raise serializers.ValidationError({"details": ERROR_CODE['2012']}) user = User.objects.filter(username=self.context['user']).last() if user: """Save first and last name of guardian""" diff --git a/junior/serializers.py b/junior/serializers.py index 2fcf7cc..34596e9 100644 --- a/junior/serializers.py +++ b/junior/serializers.py @@ -59,11 +59,11 @@ class CreateJuniorSerializer(serializers.ModelSerializer): def create(self, validated_data): """Create junior profile""" image = validated_data.get('image', None) - phone_number = validated_data.get('phone', None) - guardian_data = Guardian.objects.filter(phone=phone_number) - junior_data = Junior.objects.filter(phone=phone_number) - if phone_number and (junior_data or guardian_data): - raise serializers.ValidationError({"details":ERROR_CODE['2012']}) + # phone_number = validated_data.get('phone', None) + # guardian_data = Guardian.objects.filter(phone=phone_number) + # junior_data = Junior.objects.filter(phone=phone_number) + # if phone_number and (junior_data or guardian_data): + # raise serializers.ValidationError({"details":ERROR_CODE['2012']}) user = User.objects.filter(username=self.context['user']).last() if user: """Save first and last name of junior""" From 66bbe066862988b3f238fdb9b5f65f7a71de13e6 Mon Sep 17 00:00:00 2001 From: jain Date: Fri, 30 Jun 2023 16:24:45 +0530 Subject: [PATCH 2/3] jira-6 change country name length --- .../0007_alter_guardian_country_name.py | 18 ++++++++++++++++++ guardian/models.py | 2 +- .../0006_alter_junior_country_name.py | 18 ++++++++++++++++++ junior/models.py | 2 +- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 guardian/migrations/0007_alter_guardian_country_name.py create mode 100644 junior/migrations/0006_alter_junior_country_name.py diff --git a/guardian/migrations/0007_alter_guardian_country_name.py b/guardian/migrations/0007_alter_guardian_country_name.py new file mode 100644 index 0000000..2cbfd73 --- /dev/null +++ b/guardian/migrations/0007_alter_guardian_country_name.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-06-30 10:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('guardian', '0006_guardian_is_verified'), + ] + + operations = [ + migrations.AlterField( + model_name='guardian', + name='country_name', + field=models.CharField(blank=True, default=None, max_length=100, null=True), + ), + ] diff --git a/guardian/models.py b/guardian/models.py index 3040c82..1ecf47f 100644 --- a/guardian/models.py +++ b/guardian/models.py @@ -13,7 +13,7 @@ class Guardian(models.Model): """Contact details""" country_code = models.IntegerField(blank=True, null=True) 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) + country_name = models.CharField(max_length=100, null=True, blank=True, default=None) """Image info""" image = models.ImageField(null=True, blank=True, default=None) """Personal info""" diff --git a/junior/migrations/0006_alter_junior_country_name.py b/junior/migrations/0006_alter_junior_country_name.py new file mode 100644 index 0000000..e3db0ba --- /dev/null +++ b/junior/migrations/0006_alter_junior_country_name.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-06-30 10:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('junior', '0005_junior_is_verified'), + ] + + operations = [ + migrations.AlterField( + model_name='junior', + name='country_name', + field=models.CharField(blank=True, default=None, max_length=100, null=True), + ), + ] diff --git a/junior/models.py b/junior/models.py index 762032b..331673f 100644 --- a/junior/models.py +++ b/junior/models.py @@ -14,7 +14,7 @@ class Junior(models.Model): """Contact details""" phone = models.CharField(max_length=31, null=True, blank=True, default=None) country_code = models.IntegerField(blank=True, null=True) - country_name = models.CharField(max_length=30, null=True, blank=True, default=None) + country_name = models.CharField(max_length=100, null=True, blank=True, default=None) """Personal info""" 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) From 36cedf8c69feeb020ceb9d8c04a5c147b56c4117 Mon Sep 17 00:00:00 2001 From: jain Date: Fri, 30 Jun 2023 17:20:47 +0530 Subject: [PATCH 3/3] textual changes --- base/messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/messages.py b/base/messages.py index 7d48f97..db53373 100644 --- a/base/messages.py +++ b/base/messages.py @@ -57,7 +57,7 @@ SUCCESS_CODE = { # Success code for Thank you "3002": "Thank you for contacting us! Our Consumer Experience Team will reach out to you shortly.", # Success code for account activation - "3003": "Log in successfully", + "3003": "Log in successful", # Success code for password reset "3004": "Password reset link has been sent to your email address", # Success code for link verified