From 287cd5e7fc0de30ef6bb861747c90e8bffc7b2fb Mon Sep 17 00:00:00 2001 From: D4VIDB2 <47712832+D4VIDB2@users.noreply.github.com> Date: Tue, 18 Feb 2020 15:38:50 +0100 Subject: [PATCH] fix issue #41 If a job is paused, when django tries to format the next run time, it receives None because it is paused. This check displays the "(paused)" string in place of the next run time instead of causing AttributeError 'NoneType' object has no attribute 'strftime' --- django_apscheduler/admin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django_apscheduler/admin.py b/django_apscheduler/admin.py index 0a65f3a..f308a1c 100644 --- a/django_apscheduler/admin.py +++ b/django_apscheduler/admin.py @@ -33,6 +33,8 @@ def get_queryset(self, request): return super(DjangoJobAdmin, self).get_queryset(request) def next_run_time_sec(self, obj): + if obj.next_run_time is None: + return "(paused)" return util.localize(obj.next_run_time) def average_duration(self, obj):