Merge pull request #26 from KiwiTechLLC/dev

jira-274 user can use same number multiple time
This commit is contained in:
Ankitajain-kiwi
2023-06-30 15:53:50 +05:30
committed by GitHub
2 changed files with 10 additions and 10 deletions

View File

@ -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"""

View File

@ -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"""