From 3820c6222d0152a33457ea7b33238d1601407bdf Mon Sep 17 00:00:00 2001 From: pep-un Date: Thu, 1 Jun 2023 13:59:35 +1100 Subject: [PATCH] Update models.py fix an issue on oxomium when audit don't have date. --- conformity/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/conformity/models.py b/conformity/models.py index 64b9505..a04215e 100644 --- a/conformity/models.py +++ b/conformity/models.py @@ -297,7 +297,16 @@ class Meta: ordering = ['report_date'] def __str__(self): - return "[" + str(self.organization) + "] " + str(self.auditor) + " (" + self.report_date.strftime('%b %Y') + ")" + if self.report_date: + date = self.report_date.strftime('%b %Y') + elif self.start_date: + date = self.start_date.strftime('%b %Y') + elif self.end_date: + date = self.end_date.strftime('%b %Y') + else: + date = "xx-xxxx" + + return "[" + str(self.organization) + "] " + str(self.auditor) + " (" + date + ")" @staticmethod def get_absolute_url():