2026-05-19 04:48:13 +02:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from django.contrib import admin
|
|
|
|
|
|
|
|
|
|
from .models import BackupRun, GlobalConfig, HostConfig, ScheduleConfig, SnapshotRecord
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(GlobalConfig)
|
|
|
|
|
class GlobalConfigAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ("name", "backup_root", "updated_at")
|
|
|
|
|
readonly_fields = ("created_at", "updated_at")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(HostConfig)
|
|
|
|
|
class HostConfigAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ("host", "address", "enabled", "updated_at")
|
|
|
|
|
list_filter = ("enabled",)
|
|
|
|
|
search_fields = ("host", "address")
|
|
|
|
|
readonly_fields = ("created_at", "updated_at")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(BackupRun)
|
|
|
|
|
class BackupRunAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ("host", "run_type", "status", "started_at", "ended_at", "snapshot_path")
|
|
|
|
|
list_filter = ("run_type", "status", "started_at")
|
|
|
|
|
search_fields = ("host__host", "snapshot_path")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(SnapshotRecord)
|
|
|
|
|
class SnapshotRecordAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ("host", "kind", "dirname", "status", "started_at")
|
|
|
|
|
list_filter = ("kind", "status", "started_at")
|
|
|
|
|
search_fields = ("host__host", "dirname", "path")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(ScheduleConfig)
|
|
|
|
|
class ScheduleConfigAdmin(admin.ModelAdmin):
|
2026-05-19 04:57:10 +02:00
|
|
|
list_display = ("host", "cron_expr", "enabled", "prune", "last_status", "last_started_at", "updated_at")
|
|
|
|
|
list_filter = ("enabled", "prune", "last_status")
|
2026-05-19 04:48:13 +02:00
|
|
|
search_fields = ("host__host", "cron_expr")
|