Skip to content

Commit 92ebbce

Browse files
committed
Run task admin action
1 parent 76a61fb commit 92ebbce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dbtasks/admin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.contrib import admin
2+
from django.tasks import TaskResultStatus
23

34
from .models import ScheduledTask
45

@@ -11,6 +12,7 @@ class ScheduledTaskAdmin(admin.ModelAdmin):
1112
"status",
1213
"priority",
1314
"enqueued_at",
15+
"run_after",
1416
"finished_at",
1517
]
1618
list_filter = [
@@ -20,3 +22,8 @@ class ScheduledTaskAdmin(admin.ModelAdmin):
2022
"queue",
2123
"backend",
2224
]
25+
actions = ["run_task"]
26+
27+
@admin.action(description="Mark ready to run now")
28+
def run_task(self, request, queryset):
29+
queryset.update(status=TaskResultStatus.READY, run_after=None)

0 commit comments

Comments
 (0)