Skip to content

Commit

Permalink
Update PeriodicTaskAdmin list display (#621)
Browse files Browse the repository at this point in the history
* Update PeriodicTaskAdmin list display

* Add a blank line

* Keep interval column
  • Loading branch information
khanh96le authored Feb 7, 2023
1 parent 0793aca commit 5680798
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion django_celery_beat/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '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')
Expand Down
14 changes: 9 additions & 5 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,16 @@ def __str__(self):
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

0 comments on commit 5680798

Please sign in to comment.