Skip to content

Commit

Permalink
fix: rendering recurring task admin times out (#2514)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell authored Jul 25, 2023
1 parent 24c21ea commit cb95a92
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions api/task_processor/admin.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
from django.contrib import admin

from task_processor.models import (
RecurringTask,
RecurringTaskRun,
Task,
TaskRun,
)


class TaskRunInline(admin.StackedInline):
model = TaskRun
extra = 0
show_change_link = False


class RecurringTaskRunInline(admin.StackedInline):
model = RecurringTaskRun
extra = 0
show_change_link = False
from task_processor.models import RecurringTask


@admin.register(RecurringTask)
class RecurringTaskAdmin(admin.ModelAdmin):
inlines = (RecurringTaskRunInline,)
list_display = ("uuid", "task_identifier", "run_every", "last_run_status")
list_display = (
"uuid",
"task_identifier",
"run_every",
"last_run_status",
"is_locked",
)
readonly_fields = ("args", "kwargs")

def last_run_status(self, instance: Task) -> str:
def last_run_status(self, instance: RecurringTask) -> str:
return instance.task_runs.order_by("-started_at").first().result

3 comments on commit cb95a92

@vercel
Copy link

@vercel vercel bot commented on cb95a92 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs.flagsmith.com
docs.bullet-train.io
docs-git-main-flagsmith.vercel.app
docs-flagsmith.vercel.app

@vercel
Copy link

@vercel vercel bot commented on cb95a92 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on cb95a92 Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.