From 1698612d6a4e924a1ba550df1bec76ca279681ee Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 18 May 2024 17:42:38 +0100 Subject: [PATCH] . --- atlas/models.py | 3 +++ rcr/forms.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/atlas/models.py b/atlas/models.py index 05b13d21..53ad5ef1 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -201,6 +201,9 @@ class Condition(SynMixin, models.Model): def get_parents(self): return self.parent.all() + def get_with_subspecialty(self): + return f"{', '.join([str(i) for i in self.subspecialty.all()])} / {self.name} " + class ConditionRelationship(models.Model): child = models.ForeignKey(Condition, on_delete=models.CASCADE) diff --git a/rcr/forms.py b/rcr/forms.py index 2996d71a..5d8cf27d 100644 --- a/rcr/forms.py +++ b/rcr/forms.py @@ -56,6 +56,9 @@ class ItemForm(ModelForm): } + def __init__(self, *args, **kwargs): + super(ItemForm, self).__init__(*args, **kwargs) + self.fields['radiology_condition'].label_from_instance = lambda obj: "%s" % obj.get_with_subspecialty() class AssessorAssignmentForm(Form): items = ModelMultipleChoiceField(queryset=Item.objects.all(), widget=forms.SelectMultiple(attrs={'size': 20})) \ No newline at end of file