03019898b0
Добавлена офлайн/EndUser-подпись «ознакомлен и принял в работу» для документов отчётов и файловые вложения к задачам через Nextcloud. Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
2.2 KiB
Python
62 lines
2.2 KiB
Python
from django.contrib import admin
|
|
|
|
from apps.reports.models import ReportDocument, ReportPublication, ReportSignature, ReportTemplate
|
|
|
|
|
|
@admin.register(ReportTemplate)
|
|
class ReportTemplateAdmin(admin.ModelAdmin):
|
|
list_display = ['code', 'name', 'report_type', 'engine', 'is_default', 'is_system', 'is_active']
|
|
list_filter = ['report_type', 'engine', 'is_default', 'is_system', 'is_active']
|
|
search_fields = ['code', 'name']
|
|
readonly_fields = ['created_at', 'updated_at']
|
|
|
|
|
|
@admin.register(ReportPublication)
|
|
class ReportPublicationAdmin(admin.ModelAdmin):
|
|
list_display = [
|
|
'report_type', 'department', 'year', 'month', 'status', 'published_by', 'published_at',
|
|
]
|
|
list_filter = ['report_type', 'status', 'year']
|
|
search_fields = ['department__name', 'department__code']
|
|
raw_id_fields = ['department', 'published_by']
|
|
readonly_fields = ['updated_at']
|
|
|
|
|
|
class ReportSignatureInline(admin.TabularInline):
|
|
model = ReportSignature
|
|
extra = 0
|
|
readonly_fields = [
|
|
'signer', 'purpose', 'status', 'signed_at',
|
|
'cert_subject', 'cert_serial', 'cert_issuer',
|
|
'signature_format', 'signed_filename', 'content_sha256',
|
|
'verify_ok', 'verify_detail', 'created_at',
|
|
]
|
|
fields = readonly_fields
|
|
can_delete = False
|
|
|
|
|
|
@admin.register(ReportDocument)
|
|
class ReportDocumentAdmin(admin.ModelAdmin):
|
|
list_display = [
|
|
'title', 'department', 'kind', 'status', 'filename',
|
|
'created_by', 'published_by', 'updated_at',
|
|
]
|
|
list_filter = ['kind', 'status']
|
|
search_fields = ['title', 'filename', 'department__name']
|
|
raw_id_fields = ['department', 'created_by', 'published_by']
|
|
readonly_fields = ['created_at', 'updated_at', 'published_at']
|
|
inlines = [ReportSignatureInline]
|
|
|
|
|
|
@admin.register(ReportSignature)
|
|
class ReportSignatureAdmin(admin.ModelAdmin):
|
|
list_display = [
|
|
'document', 'signer', 'status', 'purpose', 'signed_at',
|
|
'cert_subject', 'verify_ok',
|
|
]
|
|
list_filter = ['status', 'purpose', 'signature_format']
|
|
search_fields = ['cert_subject', 'cert_serial', 'document__title', 'signed_filename']
|
|
raw_id_fields = ['document', 'signer']
|
|
readonly_fields = ['created_at', 'updated_at']
|
|
|