def getChoices(self, field_name): assessment_id = self.form.instance.assessment_id choices = None if field_name == "systems": choices = list(Endpoint.get_system_choices(assessment_id)) elif field_name == "effects": choices = list(Endpoint.get_effect_choices(assessment_id)) elif field_name == "effect_tags": choices = EffectTag.get_choices(assessment_id) elif field_name == "studies": choices = Study.get_choices(assessment_id) else: raise ValueError("Unknown field name: {}".format(field_name)) return choices
def getPrefilterQueryset(self, field_name): assessment_id = self.instance.assessment_id choices = None if field_name == "systems": choices = list(Endpoint.get_system_choices(assessment_id)) elif field_name == "organs": choices = list(Endpoint.get_organ_choices(assessment_id)) elif field_name == "effects": choices = list(Endpoint.get_effect_choices(assessment_id)) elif field_name == "iv_categories": choices = IVEndpointCategory.get_choices(assessment_id) elif field_name == "effect_tags": choices = EffectTag.get_choices(assessment_id) elif field_name == "studies": choices = Study.get_choices(assessment_id) else: raise ValueError("Unknown field name: {}".format(field_name)) return choices