From 182cea3385cc4ac35b157d0b9d510f248c939314 Mon Sep 17 00:00:00 2001 From: Oliver Lippert Date: Sun, 1 May 2022 08:54:41 +0200 Subject: [PATCH] always use datetime.date.isoformat to generate filename fixes #267 Signed-off-by: Oliver Lippert --- src/documents/models.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/documents/models.py b/src/documents/models.py index a1a787325..8f531e401 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -11,7 +11,6 @@ from django.conf import settings from django.contrib.auth.models import User from django.db import models from django.utils import timezone -from django.utils.timezone import is_aware from django.utils.translation import gettext_lazy as _ from documents.parsers import get_default_file_extension @@ -210,10 +209,8 @@ class Document(models.Model): verbose_name_plural = _("documents") def __str__(self): - if is_aware(self.created): - created = timezone.localdate(self.created).isoformat() - else: - created = datetime.date.isoformat(self.created) + created = datetime.date.isoformat(self.created) + if self.correspondent and self.title: return f"{created} {self.correspondent} {self.title}" else: