mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 18:36:18 +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):
|
||||
"""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"""
|
||||
|
@ -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"""
|
||||
|
Reference in New Issue
Block a user