From 926849f7d84ec04486cc23f7550e3c48865beecf Mon Sep 17 00:00:00 2001 From: khanh96le Date: Thu, 22 Dec 2022 16:28:12 +0700 Subject: [PATCH 1/3] Update PeriodicTaskAdmin list display --- django_celery_beat/admin.py | 2 +- django_celery_beat/models.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/django_celery_beat/admin.py b/django_celery_beat/admin.py index 7eec2fd9..29b0a98c 100644 --- a/django_celery_beat/admin.py +++ b/django_celery_beat/admin.py @@ -112,7 +112,7 @@ class PeriodicTaskAdmin(admin.ModelAdmin): model = PeriodicTask celery_app = current_app date_hierarchy = 'start_time' - list_display = ('__str__', 'enabled', 'interval', 'start_time', + list_display = ('name', 'enabled', 'scheduler', 'start_time', 'last_run_at', 'one_off') list_filter = ['enabled', 'one_off', 'task', 'start_time', 'last_run_at'] actions = ('enable_tasks', 'disable_tasks', 'toggle_tasks', 'run_tasks') diff --git a/django_celery_beat/models.py b/django_celery_beat/models.py index e5fc4f86..39d376cb 100644 --- a/django_celery_beat/models.py +++ b/django_celery_beat/models.py @@ -610,14 +610,17 @@ def __str__(self): if self.clocked: fmt = '{0.name}: {0.clocked}' return fmt.format(self) - @property - def schedule(self): + def scheduler(self): if self.interval: - return self.interval.schedule + return self.interval if self.crontab: - return self.crontab.schedule + return self.crontab if self.solar: - return self.solar.schedule + return self.solar if self.clocked: - return self.clocked.schedule + return self.clocked + + @property + def schedule(self): + return self.scheduler.schedule From 76b05da434f7b339bd025e98428351d9899983a0 Mon Sep 17 00:00:00 2001 From: khanh96le Date: Thu, 22 Dec 2022 16:34:28 +0700 Subject: [PATCH 2/3] Add a blank line --- django_celery_beat/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/django_celery_beat/models.py b/django_celery_beat/models.py index 39d376cb..b841573b 100644 --- a/django_celery_beat/models.py +++ b/django_celery_beat/models.py @@ -610,6 +610,7 @@ def __str__(self): if self.clocked: fmt = '{0.name}: {0.clocked}' return fmt.format(self) + @property def scheduler(self): if self.interval: From 84472254861c6288240ac90f61b71856a022cc9f Mon Sep 17 00:00:00 2001 From: khanh96le Date: Tue, 7 Feb 2023 17:17:05 +0700 Subject: [PATCH 3/3] Keep interval column --- django_celery_beat/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_celery_beat/admin.py b/django_celery_beat/admin.py index 29b0a98c..1b712314 100644 --- a/django_celery_beat/admin.py +++ b/django_celery_beat/admin.py @@ -112,7 +112,7 @@ class PeriodicTaskAdmin(admin.ModelAdmin): model = PeriodicTask celery_app = current_app date_hierarchy = 'start_time' - list_display = ('name', 'enabled', 'scheduler', 'start_time', + list_display = ('name', 'enabled', 'scheduler', 'interval', 'start_time', 'last_run_at', 'one_off') list_filter = ['enabled', 'one_off', 'task', 'start_time', 'last_run_at'] actions = ('enable_tasks', 'disable_tasks', 'toggle_tasks', 'run_tasks')