passcode add

This commit is contained in:
jain
2023-07-12 16:43:16 +05:30
parent 8720de4834
commit 81e314878e
3 changed files with 9 additions and 7 deletions

View File

@ -93,7 +93,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
"""Complete profile of the junior if below all data are filled"""
complete_profile_field = all([junior.phone, junior.gender, junior.country_name, junior.image,
junior.dob, junior.country_code, user.first_name, user.last_name,
user.email, junior.passcode])
user.email])
junior.is_complete_profile = False
if complete_profile_field:
junior.is_complete_profile = True
@ -224,12 +224,12 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
def get_total_count(self, obj):
"""total fields count"""
return 10
return 9
def get_complete_field_count(self, obj):
"""total filled fields count"""
field_list = [obj.auth.first_name, obj.auth.last_name, obj.auth.email, obj.country_name, obj.country_code,
obj.phone, obj.gender, obj.dob, obj.image, obj.passcode]
obj.phone, obj.gender, obj.dob, obj.image]
complete_field = [data for data in field_list if data is not None and data != '']
return len(complete_field)
class Meta(object):
@ -237,4 +237,5 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
model = Junior
fields = ['id', 'email', 'first_name', 'last_name', 'country_name', 'country_code', 'phone', 'gender', 'dob',
'guardian_code', 'referral_code','is_active', 'is_complete_profile', 'created_at', 'image',
'updated_at', 'notification_count', 'total_count', 'complete_field_count', 'signup_method']
'updated_at', 'notification_count', 'total_count', 'complete_field_count', 'signup_method',
'passcode']