Rename the DeletedDocument proxy model to a TrashedDocument. Rename the deleted_document views to trashed_document. Rename the document and deleted_document URL parameters to trashed_document. Update URL parameters to the '_id' form. Add keyword arguments. Update use of .filter_by_access(). Enclose trashed document restore method in a transaction. Sort arguments. Update app for compliance with MERCs 5 and 6. Add document page view tests. Add favorite document view tests. Movernize tests. Replace use of urlencode with furl. Update views to use ExternalObjectMixin. Refactor the document and version download views. Rename the DocumentDocumentTypeEditView to DocumentChangeTypeView. Move the trashed document views to their own module. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from __future__ import absolute_import, unicode_literals
|
|
|
|
import logging
|
|
|
|
from django.contrib import messages
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from mayan.apps.common.generics import ConfirmView
|
|
|
|
from ..permissions import permission_document_tools
|
|
from ..tasks import task_clear_image_cache, task_scan_duplicates_all
|
|
|
|
|
|
__all__ = ('ClearImageCacheView', 'ScanDuplicatedDocuments')
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ClearImageCacheView(ConfirmView):
|
|
extra_context = {
|
|
'title': _('Clear the document image cache?')
|
|
}
|
|
view_permission = permission_document_tools
|
|
|
|
def view_action(self):
|
|
task_clear_image_cache.apply_async()
|
|
messages.success(
|
|
message=_('Document cache clearing queued successfully.'),
|
|
request=self.request
|
|
)
|
|
|
|
|
|
class ScanDuplicatedDocuments(ConfirmView):
|
|
extra_context = {
|
|
'title': _('Scan for duplicated documents?')
|
|
}
|
|
view_permission = permission_document_tools
|
|
|
|
def view_action(self):
|
|
task_scan_duplicates_all.apply_async()
|
|
messages.success(
|
|
message=_('Duplicated document scan queued successfully.'),
|
|
request=self.request
|
|
)
|