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

improve admin layout #18

Merged
merged 1 commit into from
Sep 13, 2023
Merged
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
58 changes: 58 additions & 0 deletions django_toosimple_q/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,32 @@ class TaskExecAdmin(ReadOnlyAdmin):
actions = ["action_requeue"]
ordering = ["-created"]
readonly_fields = ["task_", "result"]
fieldsets = [
(
None,
{"fields": ["icon", "task_name", "state", "task_"]},
),
(
"Arguments",
{"fields": ["args", "kwargs"]},
),
(
"Time",
{"fields": ["due_", "created_", "started_", "finished_"]},
),
(
"Retries",
{"fields": ["retries", "retry_delay", "replaced_by"]},
),
(
"Execution",
{"fields": ["worker", "error"]},
),
(
"Output",
{"fields": ["stdout", "stderr", "result"]},
),
]

def arguments_(self, obj):
return format_html(
Expand Down Expand Up @@ -132,6 +158,20 @@ class ScheduleExecAdmin(ReadOnlyAdmin):
list_filter = ["name", ScheduleQueueListFilter, "state"]
actions = ["action_force_run"]
readonly_fields = ["schedule_"]
fieldsets = [
(
None,
{"fields": ["icon", "name", "state", "schedule_"]},
),
(
"Time",
{"fields": ["last_due_", "next_due_"]},
),
(
"Execution",
{"fields": ["last_task_"]},
),
]

def schedule_(self, obj):
if not obj.schedule:
Expand Down Expand Up @@ -188,6 +228,24 @@ class WorkerStatusAdmin(ReadOnlyAdmin):
list_display_links = ["label"]
ordering = ["-started", "label"]
readonly_fields = ["state"]
fieldsets = [
(
None,
{"fields": ["icon", "label"]},
),
(
"Queues",
{"fields": ["included_queues", "excluded_queues"]},
),
(
"Time",
{"fields": ["timeout", "last_tick_", "started_", "stopped_"]},
),
(
"Exit state",
{"fields": ["exit_code", "exit_log"]},
),
]

@admin.display(ordering="last_tick")
def last_tick_(self, obj):
Expand Down
Loading