Skip to content

Commit

Permalink
Merge pull request #45 from pep-un/pep-un-patch-1
Browse files Browse the repository at this point in the history
Update models.py
  • Loading branch information
pep-un authored Jun 1, 2023
2 parents 7052988 + 3820c62 commit 4e7af81
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion conformity/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 4e7af81

Please sign in to comment.