Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PeriodicTaskAdmin list display #621

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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