feat: link backup runs to snapshot records

Add a nullable SnapshotRecord foreign key to BackupRun and populate it
when run_pobsync_backup records a completed or failed snapshot. Keep the
existing snapshot_path for audit compatibility while making run-to-snapshot
navigation explicit in the database and admin.
This commit is contained in:
2026-05-19 11:13:06 +02:00
parent 0a49c5719c
commit 5808800981
5 changed files with 48 additions and 9 deletions

View File

@@ -50,9 +50,10 @@ class HostConfigAdmin(admin.ModelAdmin):
@admin.register(BackupRun)
class BackupRunAdmin(admin.ModelAdmin):
list_display = ("host", "run_type", "status", "started_at", "ended_at", "snapshot_path")
list_display = ("host", "run_type", "status", "started_at", "ended_at", "snapshot")
list_filter = ("run_type", "status", "started_at")
search_fields = ("host__host", "snapshot_path")
search_fields = ("host__host", "snapshot_path", "snapshot__dirname", "snapshot__path")
autocomplete_fields = ("snapshot",)
@admin.register(SnapshotRecord)