csv/excel method changed, uploading to alibaba cloud and providing link to frontend

This commit is contained in:
abutalib-kiwi
2023-08-18 11:41:24 +05:30
parent 4e8243c17e
commit ceaf584332
5 changed files with 56 additions and 39 deletions

View File

@ -92,10 +92,7 @@ class UserCSVReportSerializer(serializers.ModelSerializer):
:param obj: user object
:return: user phone number
"""
if profile := obj.guardian_profile.all().first():
return f"+{profile.country_code}{profile.phone}" \
if profile.country_code and profile.phone else profile.phone
elif profile := obj.junior_profile.all().first():
if profile := (obj.guardian_profile.all().first() or obj.junior_profile.all().first()):
return f"+{profile.country_code}{profile.phone}" \
if profile.country_code and profile.phone else profile.phone
else:
@ -120,9 +117,7 @@ class UserCSVReportSerializer(serializers.ModelSerializer):
:param obj: user object
:return: user type
"""
if profile := obj.guardian_profile.all().first():
return "Active" if profile.is_active else "Inactive"
elif profile := obj.junior_profile.all().first():
if profile := (obj.guardian_profile.all().first() or obj.junior_profile.all().first()):
return "Active" if profile.is_active else "Inactive"
@staticmethod