39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from django.contrib import admin
|
|
|
|
from apps.live_monitoring.models import Camera, LiveStream, WorkflowStepCamera
|
|
|
|
|
|
@admin.register(Camera)
|
|
class CameraAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "facility", "processing_line", "protocol", "active", "updated_at")
|
|
list_filter = ("active", "protocol", "facility")
|
|
search_fields = ("name", "facility", "processing_line", "stream_url")
|
|
readonly_fields = ("id", "created_at", "updated_at")
|
|
fieldsets = (
|
|
(None, {"fields": ("name", "facility", "processing_line", "active")}),
|
|
(
|
|
"Stream",
|
|
{
|
|
"fields": ("protocol", "stream_url", "auth_config"),
|
|
"description": (
|
|
"Protocol blank = use Live Monitoring settings default. "
|
|
"auth_config stays server-side (username, password, token, host, port, path…)."
|
|
),
|
|
},
|
|
),
|
|
("Meta", {"fields": ("id", "created_at", "updated_at")}),
|
|
)
|
|
|
|
|
|
@admin.register(LiveStream)
|
|
class LiveStreamAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "camera", "active", "updated_at")
|
|
list_filter = ("active",)
|
|
|
|
|
|
@admin.register(WorkflowStepCamera)
|
|
class WorkflowStepCameraAdmin(admin.ModelAdmin):
|
|
list_display = ("step", "camera", "id")
|
|
list_filter = ("camera",)
|
|
search_fields = ("camera__name",)
|