in django_airavata/apps/auth/models.py [0:0]
def value_display(self):
if self.value_type == 'text':
return self.text.text_value
elif self.value_type == 'single_choice':
if self.single_choice.choice:
try:
choice = self.ext_user_profile_field.single_choice.choices.get(id=self.single_choice.choice)
return choice.display_text
except ExtendedUserProfileSingleChoiceFieldChoice.DoesNotExist:
return None
elif self.single_choice.other_value:
return f"Other: {self.single_choice.other_value}"
elif self.value_type == 'multi_choice':
result = []
if self.multi_choice.choices:
mc_field = self.ext_user_profile_field.multi_choice
for choice_value in self.multi_choice.choices.all():
try:
choice = mc_field.choices.get(id=choice_value.value)
result.append(choice.display_text)
except ExtendedUserProfileMultiChoiceFieldChoice.DoesNotExist:
continue
if self.multi_choice.other_value:
result.append(f"Other: {self.multi_choice.other_value}")
return result
elif self.value_type == 'user_agreement':
if self.user_agreement.agreement_value:
return "Yes"
else:
return "No"
return None