django-celery-beat
django-celery-beat copied to clipboard
Req-Enable sorting on Task name
Summary:
A feature request: enable sorting on "periodic task" column
Include a brief descrioption of the problem here, and fill out the version info below.
- Celery Version: 4.4.2
- Celery-Beat Version: 2.0.0
Exact steps to reproduce the issue:
- Navigate Periodic tasks page on Django admin site
- It doesn't support sorting on column 'Periodic Task'
Detailed information
admin.py -> class PeriodicTaskAdmin -> list_display reference '__str__'
list_display = ('__str__', 'enabled', 'interval', 'start_time',
'last_run_at', 'one_off')
Can it enable sorting on the column? I did a try in this way:
- define another def for the filed:
def task_str(self, obj):
return obj.__str__()
task_str.short_description = 'Periodic Task'
task_str.admin_order_field = 'name'
- replace 'str' with the new field:
list_display = ('task_str', 'enabled', 'interval', 'start_time',
'last_run_at', 'one_off')
Thanks,
did this work for you? I never tried this way
did this work for you? I never tried this way
Yes, I did a try and it works for me while I was creating the ticket.
so you want to contribute back this back? what extra benefits does this provide? it would be great if you could provide a unit test for the proposed change as well
so you want to contribute back this back? what extra benefits does this provide? it would be great if you could provide a unit test for the proposed change as well
sure, let me do this.
@gainskills was this implemented?
@mg64ve , verified with the version: v2.5.0, the req has been supported already.