From: Trenton Holmes Date: Wed, 1 Jun 2022 15:03:38 +0000 (-0700) Subject: Updates the Document str to account for a blank title instead of assuming title will... X-Git-Tag: v1.8.0-beta.rc1~79^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1057%2Fhead;p=thirdparty%2Fpaperless-ngx.git Updates the Document str to account for a blank title instead of assuming title will be populated --- diff --git a/src/documents/models.py b/src/documents/models.py index b85c56037a..0061e5d0fc 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -233,10 +233,13 @@ class Document(models.Model): # Convert UTC database time to local time created = datetime.date.isoformat(timezone.localdate(self.created)) - if self.correspondent and self.title: - return f"{created} {self.correspondent} {self.title}" - else: - return f"{created} {self.title}" + res = f"{created}" + + if self.correspondent: + res += f" {self.correspondent}" + if self.title: + res += f" {self.title}" + return res @property def source_path(self):