django-celery-beat icon indicating copy to clipboard operation
django-celery-beat copied to clipboard

Req-Enable sorting on Task name

Open gainskills opened this issue 4 years ago • 5 comments

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:

  1. Navigate Periodic tasks page on Django admin site
  2. 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:

  1. 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'
  1. replace 'str' with the new field:
    list_display = ('task_str', 'enabled', 'interval', 'start_time',
                    'last_run_at', 'one_off')

image

Thanks,

gainskills avatar Apr 23 '20 23:04 gainskills

did this work for you? I never tried this way

auvipy avatar Jan 18 '21 14:01 auvipy

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.

gainskills avatar Jan 18 '21 20:01 gainskills

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

auvipy avatar Jan 19 '21 01:01 auvipy

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 avatar Jan 19 '21 21:01 gainskills

@gainskills was this implemented?

mg64ve avatar May 21 '22 08:05 mg64ve

@mg64ve , verified with the version: v2.5.0, the req has been supported already. image

gainskills avatar Oct 15 '23 11:10 gainskills