From 1245bc36b14a6f74deb7a346ec2a70954be217b6 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 4 Feb 2021 21:15:04 +0000 Subject: [PATCH] . --- longs/models.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/longs/models.py b/longs/models.py index 641343a5..d7031798 100644 --- a/longs/models.py +++ b/longs/models.py @@ -115,17 +115,9 @@ class Long(models.Model): authors = ", ".join([i.username for i in self.author.all()]) return authors - def get_examinations(self): - """Returns a comma seperated text list of regions""" - examinations = ", ".join([i.examination for i in self.examination.all()]) - return examinations - def __str__(self): - exams = self.get_examinations() - lat = "" - if self.laterality != "NONE": - lat = self.laterality - return "{} / {} {}".format(exams, lat, n) + examinations = [series.get_examinations() for series in self.series] + return "{} : {}".format(self.history, ", ".join(examinations)) def GetExams(self): e = self.exams.all().values_list("name", flat=True) @@ -160,6 +152,11 @@ class LongSeries(models.Model): long = models.ForeignKey("Long", related_name="long", on_delete=models.SET_NULL, null=True) description = models.TextField(blank=True, help_text="Description of stack, for admin organisation") + def get_examinations(self): + """Returns a comma seperated text list of regions""" + examinations = ", ".join([i.examination for i in self.examination.all()]) + return examinations + #class LongImage(models.Model): # long = models.ForeignKey(Long, # related_name="images",