From 8d78868e886873592fbc4c91aed2a06f128f8616 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 22 Dec 2023 13:37:19 -0500 Subject: [PATCH] membershipworks: Handle case where scrape task has never been run in admin action --- membershipworks/admin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/membershipworks/admin.py b/membershipworks/admin.py index be82d98..5a9d3c0 100644 --- a/membershipworks/admin.py +++ b/membershipworks/admin.py @@ -32,7 +32,10 @@ class BaseMembershipWorksAdmin(DjangoObjectActions, ReadOnlyAdmin): .order_by("started") .last() ) - tool["label"] = f"Refresh Data [Last Run {naturaltime(last_run.started)}]" + last_run_time = ( + naturaltime(last_run.started) if last_run is not None else "Never" + ) + tool["label"] = f"Refresh Data [Last Run {last_run_time}]" return tool @action