From afa1b86a4ddde7d2f5abcd0f05d6b24cb9c3ebf8 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:11:43 -0700 Subject: [PATCH] Converts the date, reduces decisions in templating --- src/documents/consumer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index c3ef86ef3..e618f0bb8 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -649,7 +649,7 @@ class Consumer(LoggingMixin): Consumption template title placeholders can only include items that are assigned as part of this template (since auto-matching hasnt happened yet) """ - local_added = timezone.now() + local_added = timezone.localtime(timezone.now()) correspondent_name = ( Correspondent.objects.get(pk=self.override_correspondent_id).name @@ -668,8 +668,8 @@ class Consumer(LoggingMixin): ) return title.format( - correspondent=correspondent_name or None, - document_type=doc_type_name or None, + correspondent=correspondent_name, + document_type=doc_type_name, added=local_added.isoformat(), added_year=local_added.strftime("%Y"), added_year_short=local_added.strftime("%y"), @@ -677,7 +677,7 @@ class Consumer(LoggingMixin): added_month_name=local_added.strftime("%B"), added_month_name_short=local_added.strftime("%b"), added_day=local_added.strftime("%d"), - owner_username=owner_username or None, + owner_username=owner_username, ).strip() def _store(