From b6339ca95fdb14fdab19e52f042407a7ca94361c Mon Sep 17 00:00:00 2001 From: TLSM Date: Mon, 16 May 2022 11:33:26 -0400 Subject: [PATCH] Add exact timestamps to mod log. Modlog only had ModAction.age_string visible. However, we sometimes need to know the exact time an action was taken. Adds `created_string` to ModAction, and exposes that to log.html. --- files/classes/mod_logs.py | 4 ++++ files/templates/log.html | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index f1a9dc585..6adf58e7b 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -60,6 +60,10 @@ class ModAction(Base): years = int(months / 12) return f"{years}yr ago" + @property + @lazy + def created_string(self): + return time.strftime('%d %b %Y %H:%M:%S UTC', time.gmtime(self.created_utc)) @property def note(self): diff --git a/files/templates/log.html b/files/templates/log.html index 16d9539c3..beafaef8c 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -106,7 +106,9 @@ {{ma.string | safe}} -
{{ma.age_string}} +
+ {{ma.age_string}} +