Documents now have their own dedicated DocumentPage submodel. The old DocumentPage is now called DocumentVersionPage. This allows mappings between document pages and document version pages, allowing renumbering, appending pages. DocumentPages have a content_object to map them to any other object. For now they only map to DocumentVersionPages. New option added to the version upload form to append the pages of the new version. A new view was added to just append new pages with wraps the new document version upload form and hides the append pages checkbox set to True. Add a new action, reset_pages to reset the pages of the document to those of the latest version. Missing: appending tests, checks for proper content_object in OCR and document parsing. Author: Roberto Rosario <roberto.rosario@mayan-edms.com> Date: Thu Oct 11 12:00:25 2019 -0400
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from django.contrib import admin
|
|
|
|
from .models import (
|
|
DeletedDocument, Document, DocumentType, DocumentTypeFilename,
|
|
DocumentVersion, DocumentVersionPage, DuplicatedDocument,
|
|
RecentDocument
|
|
)
|
|
|
|
|
|
class DocumentTypeFilenameInline(admin.StackedInline):
|
|
model = DocumentTypeFilename
|
|
extra = 1
|
|
classes = ('collapse-open',)
|
|
allow_add = True
|
|
|
|
|
|
class DocumentVersionInline(admin.StackedInline):
|
|
model = DocumentVersion
|
|
extra = 1
|
|
classes = ('collapse-open',)
|
|
allow_add = True
|
|
|
|
|
|
class DocumentVersionPageInline(admin.StackedInline):
|
|
model = DocumentVersionPage
|
|
extra = 1
|
|
classes = ('collapse-open',)
|
|
allow_add = True
|
|
|
|
|
|
@admin.register(DeletedDocument)
|
|
class DeletedDocumentAdmin(admin.ModelAdmin):
|
|
date_hierarchy = 'deleted_date_time'
|
|
list_filter = ('document_type',)
|
|
list_display = ('uuid', 'label', 'document_type', 'deleted_date_time')
|
|
readonly_fields = ('uuid', 'document_type')
|
|
|
|
|
|
@admin.register(Document)
|
|
class DocumentAdmin(admin.ModelAdmin):
|
|
date_hierarchy = 'date_added'
|
|
inlines = (DocumentVersionInline,)
|
|
list_filter = ('document_type', 'is_stub')
|
|
list_display = ('uuid', 'label', 'document_type', 'date_added', 'is_stub')
|
|
readonly_fields = ('uuid', 'document_type', 'date_added')
|
|
|
|
|
|
@admin.register(DocumentType)
|
|
class DocumentTypeAdmin(admin.ModelAdmin):
|
|
inlines = (DocumentTypeFilenameInline,)
|
|
list_display = (
|
|
'label', 'trash_time_period', 'trash_time_unit', 'delete_time_period',
|
|
'delete_time_unit'
|
|
)
|
|
|
|
|
|
@admin.register(DuplicatedDocument)
|
|
class DuplicatedDocumentAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
'document', 'datetime_added'
|
|
)
|
|
|
|
|
|
@admin.register(RecentDocument)
|
|
class RecentDocumentAdmin(admin.ModelAdmin):
|
|
date_hierarchy = 'datetime_accessed'
|
|
list_display = ('user', 'document', 'datetime_accessed')
|
|
list_display_links = ('document', 'datetime_accessed')
|
|
list_filter = ('user',)
|
|
readonly_fields = ('user', 'document', 'datetime_accessed')
|