This commit is contained in:
Ross
2021-02-05 12:43:03 +00:00
parent f76a96dcbd
commit 566579e78e
+7 -5
View File
@@ -94,7 +94,7 @@ class Long(models.Model):
return authors return authors
def __str__(self): def __str__(self):
examinations = [series.examination for series in self.series.all()] examinations = [series.get_examination() for series in self.series.all()]
return "{} : {}".format(self.history, ", ".join(examinations)) return "{} : {}".format(self.history, ", ".join(examinations))
def GetExams(self): def GetExams(self):
@@ -131,10 +131,12 @@ class LongSeries(models.Model):
long = models.ForeignKey("Long", help_text="The question this series should be associated with", related_name="series", on_delete=models.SET_NULL, null=True) long = models.ForeignKey("Long", help_text="The question this series should be associated with", related_name="series", on_delete=models.SET_NULL, null=True)
description = models.TextField(blank=True, help_text="Description of stack, for admin organisation, will not be visible when taking") description = models.TextField(blank=True, help_text="Description of stack, for admin organisation, will not be visible when taking")
#def get_examinations(self): def __str__(self):
# """Returns a comma seperated text list of regions""" return "{} : {}".format(self.get_examination(), self.description)
# examinations = ", ".join([i.examination for i in self.examination.all()])
# return examinations def get_examination(self):
"""Returns a comma seperated text list of regions"""
return str(self.examinations)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('longs:long_series_detail', kwargs={'pk': self.pk}) return reverse('longs:long_series_detail', kwargs={'pk': self.pk})