mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 17:14:55 +00:00
Merge pull request #26 from KiwiTechLLC/dev
jira-274 user can use same number multiple time
This commit is contained in:
@ -86,11 +86,11 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
"""Create guardian profile"""
|
"""Create guardian profile"""
|
||||||
phone_number = validated_data.get('phone', None)
|
# phone_number = validated_data.get('phone', None)
|
||||||
guardian_data = Guardian.objects.filter(phone=phone_number)
|
# guardian_data = Guardian.objects.filter(phone=phone_number)
|
||||||
junior_data = Junior.objects.filter(phone=phone_number)
|
# junior_data = Junior.objects.filter(phone=phone_number)
|
||||||
if phone_number and (guardian_data or junior_data):
|
# if phone_number and (guardian_data or junior_data):
|
||||||
raise serializers.ValidationError({"details": ERROR_CODE['2012']})
|
# raise serializers.ValidationError({"details": ERROR_CODE['2012']})
|
||||||
user = User.objects.filter(username=self.context['user']).last()
|
user = User.objects.filter(username=self.context['user']).last()
|
||||||
if user:
|
if user:
|
||||||
"""Save first and last name of guardian"""
|
"""Save first and last name of guardian"""
|
||||||
|
|||||||
@ -59,11 +59,11 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
|
|||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
"""Create junior profile"""
|
"""Create junior profile"""
|
||||||
image = validated_data.get('image', None)
|
image = validated_data.get('image', None)
|
||||||
phone_number = validated_data.get('phone', None)
|
# phone_number = validated_data.get('phone', None)
|
||||||
guardian_data = Guardian.objects.filter(phone=phone_number)
|
# guardian_data = Guardian.objects.filter(phone=phone_number)
|
||||||
junior_data = Junior.objects.filter(phone=phone_number)
|
# junior_data = Junior.objects.filter(phone=phone_number)
|
||||||
if phone_number and (junior_data or guardian_data):
|
# if phone_number and (junior_data or guardian_data):
|
||||||
raise serializers.ValidationError({"details":ERROR_CODE['2012']})
|
# raise serializers.ValidationError({"details":ERROR_CODE['2012']})
|
||||||
user = User.objects.filter(username=self.context['user']).last()
|
user = User.objects.filter(username=self.context['user']).last()
|
||||||
if user:
|
if user:
|
||||||
"""Save first and last name of junior"""
|
"""Save first and last name of junior"""
|
||||||
|
|||||||
Reference in New Issue
Block a user