Files
state-corp-backend/src/apps/form_6/admin.py
Aleksandr Meshchriakov ee497bd557
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m53s
CI/CD Pipeline / Run Tests (push) Successful in 2m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 3m26s
CI/CD Pipeline / Push to Gitea Registry (push) Failing after 20s
CI/CD Pipeline / Deploy to Server (push) Has been skipped
Fix Ruff import ordering for CI
2026-04-07 16:37:47 +02:00

172 lines
4.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Админка формы Ф-6."""
from apps.core.admin_mixins import HiddenFromAdminIndexMixin
from apps.core.admin_paper_forms import PaperFormPreviewAdminMixin
from apps.form_6.models import FormF6Record
from django.contrib import admin
@admin.register(FormF6Record)
class FormF6RecordAdmin(
HiddenFromAdminIndexMixin,
PaperFormPreviewAdminMixin,
admin.ModelAdmin,
):
"""Админка записей формы Ф-6."""
paper_form_title = "Форма Ф-6. Возрастная структура оборудования"
paper_form_sections = (
("Категоризация", ("row_code", "category")),
(
"Общие данные",
(
"total_equipment",
"domestic_equipment",
"imported_equipment",
),
),
(
"Возрастная структура",
(
"age_under_5",
"age_5_10",
"age_10_15",
"age_15_20",
"age_over_20",
),
),
(
"С ЧПУ по возрасту",
(
"cnc_total",
"cnc_under_5",
"cnc_5_10",
"cnc_10_15",
"cnc_15_20",
"cnc_over_20",
),
),
(
"Показатели использования",
(
"avg_shift_work",
"utilization_rate",
"physical_wear_percent",
),
),
("Потребности", ("workplaces_without_equipment", "equipment_to_replace")),
)
list_display = [
"organization",
"report_period_admin",
"version_status_admin",
"load_batch",
"row_code",
"category",
"total_equipment",
"physical_wear_percent",
"created_at",
]
list_filter = [
"report_year",
"report_quarter",
"is_active_version",
"load_batch",
"created_at",
]
search_fields = ["organization__name", "organization__inn", "row_code", "category"]
readonly_fields = [
"id",
"created_at",
"updated_at",
"paper_form_preview",
"report_period_admin",
"version_status_admin",
"superseded_at",
"superseded_by_batch",
]
raw_id_fields = ["organization"]
ordering = ["-is_active_version", "-report_year", "-report_quarter", "-created_at"]
fieldsets = [
(
"Основная информация",
{
"fields": [
"id",
"organization",
"load_batch",
"report_year",
"report_quarter",
]
},
),
(
"Версия записи",
{
"fields": [
"report_period_admin",
"version_status_admin",
"superseded_at",
"superseded_by_batch",
],
},
),
("Категоризация", {"fields": ["row_code", "category"]}),
(
"Общие данные",
{
"fields": [
"total_equipment",
"domestic_equipment",
"imported_equipment",
],
},
),
(
"Возрастная структура",
{
"fields": [
"age_under_5",
"age_5_10",
"age_10_15",
"age_15_20",
"age_over_20",
],
},
),
(
"С ЧПУ по возрасту",
{
"fields": [
"cnc_total",
"cnc_under_5",
"cnc_5_10",
"cnc_10_15",
"cnc_15_20",
"cnc_over_20",
],
"classes": ["collapse"],
},
),
(
"Показатели использования",
{
"fields": [
"avg_shift_work",
"utilization_rate",
"physical_wear_percent",
],
},
),
(
"Потребности",
{"fields": ["workplaces_without_equipment", "equipment_to_replace"]},
),
(
"Системные поля",
{"fields": ["created_at", "updated_at"], "classes": ["collapse"]},
),
]