feat: expand platform APIs, sources, and test coverage
Some checks failed
CI/CD Pipeline / Run Tests (pull_request) Successful in 1m53s
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m54s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
Some checks failed
CI/CD Pipeline / Run Tests (pull_request) Successful in 1m53s
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m54s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
This commit is contained in:
@@ -6,6 +6,7 @@ from apps.parsers.models import (
|
||||
FinancialReport,
|
||||
FinancialReportLine,
|
||||
IndustrialCertificateRecord,
|
||||
IndustrialProductRecord,
|
||||
InspectionRecord,
|
||||
ManufacturerRecord,
|
||||
ParserLoadLog,
|
||||
@@ -275,6 +276,87 @@ class ManufacturerRecordAdmin(admin.ModelAdmin):
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(IndustrialProductRecord)
|
||||
class IndustrialProductRecordAdmin(admin.ModelAdmin):
|
||||
"""Admin для реестра промышленной продукции."""
|
||||
|
||||
list_display = [
|
||||
"registry_number",
|
||||
"product_name_short",
|
||||
"organisation_name_short",
|
||||
"inn",
|
||||
"ogrn",
|
||||
"load_batch",
|
||||
"created_at",
|
||||
]
|
||||
list_filter = ["load_batch", "created_at"]
|
||||
search_fields = [
|
||||
"registry_number",
|
||||
"product_name",
|
||||
"full_organisation_name",
|
||||
"inn",
|
||||
"ogrn",
|
||||
"okpd2_code",
|
||||
"tnved_code",
|
||||
]
|
||||
readonly_fields = ["created_at", "updated_at", "load_batch"]
|
||||
ordering = ["-created_at"]
|
||||
list_per_page = 100
|
||||
date_hierarchy = "created_at"
|
||||
|
||||
fieldsets = (
|
||||
(
|
||||
"Запись реестра",
|
||||
{
|
||||
"fields": (
|
||||
"registry_number",
|
||||
"product_name",
|
||||
"product_model",
|
||||
"regulatory_document",
|
||||
)
|
||||
},
|
||||
),
|
||||
(
|
||||
"Организация",
|
||||
{"fields": ("full_organisation_name", "inn", "ogrn")},
|
||||
),
|
||||
(
|
||||
"Классификаторы",
|
||||
{"fields": ("okpd2_code", "tnved_code")},
|
||||
),
|
||||
(
|
||||
"Системное",
|
||||
{
|
||||
"fields": ("load_batch", "created_at", "updated_at"),
|
||||
"classes": ("collapse",),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
def product_name_short(self, obj):
|
||||
"""Сокращённое название продукции."""
|
||||
name = obj.product_name or ""
|
||||
return name[:60] + "..." if len(name) > 60 else name
|
||||
|
||||
def organisation_name_short(self, obj):
|
||||
"""Сокращённое название организации."""
|
||||
name = obj.full_organisation_name or ""
|
||||
return name[:60] + "..." if len(name) > 60 else name
|
||||
|
||||
product_name_short.short_description = "Продукция"
|
||||
product_name_short.admin_order_field = "product_name"
|
||||
organisation_name_short.short_description = "Организация"
|
||||
organisation_name_short.admin_order_field = "full_organisation_name"
|
||||
|
||||
def has_add_permission(self, request):
|
||||
"""Запретить создание записей вручную."""
|
||||
return False
|
||||
|
||||
def has_change_permission(self, request, obj=None):
|
||||
"""Запретить редактирование записей."""
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(InspectionRecord)
|
||||
class InspectionRecordAdmin(admin.ModelAdmin):
|
||||
"""Admin для проверок из Единого реестра проверок."""
|
||||
|
||||
Reference in New Issue
Block a user