示例#1
0
	def mutate(self, info, **kwargs):
		user = info.context.user
		Validation.check_user_login(user)

		try:
			instance = UserProfile.objects.filter(user=user).first()
			if not instance:
				instance = UserProfile.objects.create(user=user)

			mother_tongue = kwargs.get('mother_tongue', instance.mother_tongue)
			if mother_tongue:
				mother_tongue = Validation.validate_mother_tongue(mother_tongue)

			religion = kwargs.get('religion', instance.religion)
			if religion:
				religion = Validation.validate_religion(religion)

			caste = kwargs.get('caste', instance.caste)
			if caste:
				caste = Validation.validate_caste(caste)

			raasi = kwargs.get('raasi', instance.raasi)
			if raasi:
				raasi = Validation.validate_raasi(raasi)

			sub_caste = kwargs.get('sub_caste', instance.sub_caste)
			if sub_caste:
				sub_caste = Validation.validate_sub_caste(sub_caste)

			star = kwargs.get('star', instance.star)
			if star:
				star = Validation.validate_star(star)

			highest_education = kwargs.get('highest_education', instance.highest_education)
			if highest_education:
				highest_education = Validation.validate_highest_education(highest_education)

			occupation = kwargs.get('occupation', instance.occupation)
			if occupation:
				occupation = Validation.validate_occupation(occupation)

			instance.gender = kwargs.get('gender', instance.gender)
			instance.dob = kwargs.get('dob', instance.dob)
			instance.about_me = kwargs.get('about_me', instance.about_me)
			instance.about_family = kwargs.get('about_family', instance.about_family)
			instance.profile_created_by = kwargs.get('profile_created_by', instance.profile_created_by)
			instance.country = kwargs.get('country', instance.country)
			instance.city = kwargs.get('city', instance.city)
			instance.state = kwargs.get('state', instance.state)
			instance.work_location = kwargs.get('work_location', instance.work_location)
			instance.native_location = kwargs.get('native_location', instance.native_location)
			instance.gothram = kwargs.get('gothram', instance.gothram)
			instance.college = kwargs.get('college', instance.college)
			instance.height = kwargs.get('height', instance.height)
			instance.weight = kwargs.get('weight', instance.weight)
			instance.physical_status = kwargs.get('physical_status', instance.physical_status)
			instance.body_type = kwargs.get('body_type', instance.body_type)
			instance.eating_habits = kwargs.get('eating_habits', instance.eating_habits)
			instance.drinking_habits = kwargs.get('drinking_habits', instance.drinking_habits)
			instance.smoking_habits = kwargs.get('smoking_habits', instance.smoking_habits)
			instance.mother_tongue = mother_tongue
			instance.religion = religion
			instance.caste = caste
			instance.raasi = raasi
			instance.sub_caste = sub_caste
			instance.star = star
			instance.highest_education = highest_education
			instance.employed_in = kwargs.get('employed_in', instance.employed_in)
			instance.occupation = occupation
			instance.dosham = kwargs.get('dosham', instance.dosham)

			if instance.gender and instance.dob and instance.profile_created_by and instance.city:
				instance.completed_basic_details = True
			if instance.mother_tongue and instance.height and instance.weight and instance.body_type:
				instance.completed_profile_details = True
			if instance.religion and instance.caste and instance.raasi and instance.sub_caste and instance.star:
				instance.completed_relegious_details = True
			if instance.highest_education and instance.employed_in and instance.college:
				instance.completed_professional_details = True
			instance.save()

			status='success'
			message = 'Profile details updated!'
		except Exception as e:
			status = 'error'
			message = e

		return UpdateProfile(status=status, message=message)
示例#2
0
	def mutate(self, info, **kwargs):
		user = info.context.user
		Validation.check_user_login(user)

		try:
			instance = PartnerPreference.objects.filter(user=user).first()
			if not instance:
				instance = PartnerPreference.objects.create(user=user)

			mother_tongue = kwargs.get('mother_tongue', instance.mother_tongue)
			if mother_tongue:
				mother_tongue = Validation.validate_mother_tongue(mother_tongue)

			religion = kwargs.get('religion', instance.religion)
			if religion:
				religion = Validation.validate_religion(religion)

			caste = kwargs.get('caste', instance.caste)
			if caste:
				caste = Validation.validate_caste(caste)

			raasi = kwargs.get('raasi', instance.raasi)
			if raasi:
				raasi = Validation.validate_raasi(raasi)

			sub_caste = kwargs.get('sub_caste', instance.sub_caste)
			if sub_caste:
				sub_caste = Validation.validate_sub_caste(sub_caste)

			star = kwargs.get('star', instance.star)
			if star:
				star = Validation.validate_star(star)

			highest_education = kwargs.get('highest_education', instance.highest_education)
			if highest_education:
				highest_education = Validation.validate_highest_education(highest_education)

			occupation = kwargs.get('occupation', instance.occupation)
			if occupation:
				occupation = Validation.validate_occupation(occupation)
	
			instance.age_from = kwargs.get('age_from', instance.age_from)
			instance.age_to = kwargs.get('age_to', instance.age_to)
			instance.height_from = kwargs.get('height_from', instance.height_from)
			instance.height_to = kwargs.get('height_to', instance.height_to)
			instance.physical_status = kwargs.get('physical_status', instance.physical_status)
			instance.body_type = kwargs.get('body_type', instance.body_type)
			instance.eating_habits = kwargs.get('eating_habits', instance.eating_habits)
			instance.drinking_habits = kwargs.get('drinking_habits', instance.drinking_habits)
			instance.smoking_habits = kwargs.get('smoking_habits', instance.smoking_habits)
			instance.mother_tongue = mother_tongue
			instance.religion = religion
			instance.caste = caste
			instance.raasi = raasi
			instance.sub_caste = sub_caste
			instance.star = star
			instance.highest_education = highest_education
			instance.employed_in = kwargs.get('employed_in', instance.employed_in)
			instance.occupation = occupation
			instance.income_from = kwargs.get('income_from', instance.income_from)
			instance.income_to = kwargs.get('income_to', instance.income_to)
			instance.dosham = kwargs.get('dosham', instance.dosham)
			instance.about_partner = kwargs.get('about_partner', instance.about_partner)
			instance.save()

			status='success'
			message = 'Partner details updated!'
		except Exception as e:
			status = 'error'
			message = e

		return UpdatePartner(status=status, message=message)