always use datetime.date.isoformat to generate filename

fixes #267

Signed-off-by: Oliver Lippert <info@trusty.codes>
This commit is contained in:
Oliver Lippert 2022-05-01 08:54:41 +02:00
parent 0ba1ba55bd
commit 182cea3385

View File

@ -11,7 +11,6 @@ from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.timezone import is_aware
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from documents.parsers import get_default_file_extension from documents.parsers import get_default_file_extension
@ -210,10 +209,8 @@ class Document(models.Model):
verbose_name_plural = _("documents") verbose_name_plural = _("documents")
def __str__(self): def __str__(self):
if is_aware(self.created): created = datetime.date.isoformat(self.created)
created = timezone.localdate(self.created).isoformat()
else:
created = datetime.date.isoformat(self.created)
if self.correspondent and self.title: if self.correspondent and self.title:
return f"{created} {self.correspondent} {self.title}" return f"{created} {self.correspondent} {self.title}"
else: else: