16bf2cf1c7
Конфиг счётчиков и день/ночь-тарифы, учёт энергосистем (генераторы, инверторы), доступ к разделу РРО/ПРРО. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import PowerAsset, PowerAssetService
|
|
|
|
|
|
class PowerAssetServiceInline(admin.TabularInline):
|
|
model = PowerAssetService
|
|
extra = 0
|
|
fields = (
|
|
'service_date', 'kind', 'description', 'performed_by_name',
|
|
'engine_hours', 'cost', 'next_service_at',
|
|
)
|
|
ordering = ('-service_date',)
|
|
|
|
|
|
@admin.register(PowerAsset)
|
|
class PowerAssetAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
'asset_type', 'brand', 'model_name', 'serial_number',
|
|
'location', 'status', 'capacity_kw',
|
|
'last_serviced_at', 'next_service_at', 'installed_at',
|
|
)
|
|
list_filter = ('asset_type', 'status')
|
|
search_fields = ('brand', 'model_name', 'serial_number', 'inventory_number', 'notes')
|
|
autocomplete_fields = ('location',)
|
|
raw_id_fields = ('created_by',)
|
|
inlines = [PowerAssetServiceInline]
|
|
|
|
|
|
@admin.register(PowerAssetService)
|
|
class PowerAssetServiceAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
'service_date', 'asset', 'kind', 'performed_by_name',
|
|
'engine_hours', 'next_service_at',
|
|
)
|
|
list_filter = ('kind',)
|
|
search_fields = ('description', 'performed_by_name', 'asset__model_name', 'asset__serial_number')
|
|
raw_id_fields = ('asset', 'performed_by', 'created_by')
|