43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
"""Django admin конфигурация приложения camlaps."""
|
|
|
|
from django.contrib import admin
|
|
|
|
from .models import Camera, TimelapseJob
|
|
|
|
|
|
@admin.register(Camera)
|
|
class CameraAdmin(admin.ModelAdmin):
|
|
"""Настройки отображения модели Camera в админке."""
|
|
list_display = ('name', 'slug', 'storage_path', 'is_active', 'updated_at')
|
|
list_filter = ('is_active',)
|
|
search_fields = ('name', 'slug', 'storage_path')
|
|
|
|
|
|
@admin.register(TimelapseJob)
|
|
class TimelapseJobAdmin(admin.ModelAdmin):
|
|
"""Настройки отображения модели TimelapseJob в админке."""
|
|
list_display = (
|
|
'id',
|
|
'camera',
|
|
'date_from',
|
|
'date_to',
|
|
'sampling_interval_minutes',
|
|
'anchor_time',
|
|
'fps',
|
|
'status',
|
|
'progress_percent',
|
|
'created_at',
|
|
)
|
|
list_filter = ('status', 'include_night', 'sampling_preset', 'camera')
|
|
search_fields = ('camera__name', 'output_rel_path', 'error_message')
|
|
readonly_fields = (
|
|
'progress_percent',
|
|
'frames_total',
|
|
'frames_processed',
|
|
'days_total',
|
|
'days_with_frames',
|
|
'days_skipped',
|
|
'started_at',
|
|
'finished_at',
|
|
)
|