Move documents apps history events to a separate file
This commit is contained in:
@@ -26,7 +26,7 @@ from .permissions import (PERMISSION_DOCUMENT_CREATE,
|
||||
PERMISSION_DOCUMENT_TYPE_EDIT, PERMISSION_DOCUMENT_TYPE_DELETE,
|
||||
PERMISSION_DOCUMENT_TYPE_CREATE, PERMISSION_DOCUMENT_TYPE_VIEW,
|
||||
PERMISSION_DOCUMENT_NEW_VERSION)
|
||||
from .literals import (HISTORY_DOCUMENT_CREATED,
|
||||
from .events import (HISTORY_DOCUMENT_CREATED,
|
||||
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
|
||||
from .conf.settings import ZOOM_MAX_LEVEL
|
||||
from .conf.settings import ZOOM_MIN_LEVEL
|
||||
|
||||
28
apps/documents/events.py
Normal file
28
apps/documents/events.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
HISTORY_DOCUMENT_CREATED = {
|
||||
'namespace': 'documents', 'name': 'document_created',
|
||||
'label': _(u'Document creation'),
|
||||
'summary': _(u'Document "%(content_object)s" created by %(fullname)s.'),
|
||||
'details': _(u'Document "%(content_object)s" created on %(datetime)s by %(fullname)s.'),
|
||||
'expressions': {'fullname': 'user.get_full_name() if user.get_full_name() else user.username'}
|
||||
}
|
||||
|
||||
HISTORY_DOCUMENT_EDITED = {
|
||||
'namespace': 'documents', 'name': 'document_edited',
|
||||
'label': _(u'Document edited'),
|
||||
'summary': _(u'Document "%(content_object)s" edited by %(fullname)s.'),
|
||||
'details': _(u'Document "%(content_object)s" was edited on %(datetime)s by %(fullname)s. The following changes took place: %(changes)s.'),
|
||||
'expressions': {
|
||||
'fullname': 'user.get_full_name() if user.get_full_name() else user.username',
|
||||
'changes': 'u\', \'.join([\'"%s": "%s" -> "%s"\' % (key, value[\'old_value\'], value[\'new_value\']) for key, value in diff.items()])'
|
||||
}
|
||||
}
|
||||
|
||||
HISTORY_DOCUMENT_DELETED = {
|
||||
'namespace': 'documents', 'name': 'document_deleted',
|
||||
'label': _(u'Document deleted'),
|
||||
'summary': _(u'Document "%(document)s" deleted by %(fullname)s.'),
|
||||
'details': _(u'Document "%(document)s" deleted on %(datetime)s by %(fullname)s.'),
|
||||
'expressions': {'fullname': 'user.get_full_name() if user.get_full_name() else user.username'}
|
||||
}
|
||||
@@ -5,33 +5,6 @@ PICTURE_ERROR_MEDIUM = u'1297211435_error.png'
|
||||
PICTURE_UNKNOWN_SMALL = u'1299549572_unknown2.png'
|
||||
PICTURE_UNKNOWN_MEDIUM = u'1299549805_unknown.png'
|
||||
|
||||
HISTORY_DOCUMENT_CREATED = {
|
||||
'namespace': 'documents', 'name': 'document_created',
|
||||
'label': _(u'Document creation'),
|
||||
'summary': _(u'Document "%(content_object)s" created by %(fullname)s.'),
|
||||
'details': _(u'Document "%(content_object)s" created on %(datetime)s by %(fullname)s.'),
|
||||
'expressions': {'fullname': 'user.get_full_name() if user.get_full_name() else user.username'}
|
||||
}
|
||||
|
||||
HISTORY_DOCUMENT_EDITED = {
|
||||
'namespace': 'documents', 'name': 'document_edited',
|
||||
'label': _(u'Document edited'),
|
||||
'summary': _(u'Document "%(content_object)s" edited by %(fullname)s.'),
|
||||
'details': _(u'Document "%(content_object)s" was edited on %(datetime)s by %(fullname)s. The following changes took place: %(changes)s.'),
|
||||
'expressions': {
|
||||
'fullname': 'user.get_full_name() if user.get_full_name() else user.username',
|
||||
'changes': 'u\', \'.join([\'"%s": "%s" -> "%s"\' % (key, value[\'old_value\'], value[\'new_value\']) for key, value in diff.items()])'
|
||||
}
|
||||
}
|
||||
|
||||
HISTORY_DOCUMENT_DELETED = {
|
||||
'namespace': 'documents', 'name': 'document_deleted',
|
||||
'label': _(u'Document deleted'),
|
||||
'summary': _(u'Document "%(document)s" deleted by %(fullname)s.'),
|
||||
'details': _(u'Document "%(document)s" deleted on %(datetime)s by %(fullname)s.'),
|
||||
'expressions': {'fullname': 'user.get_full_name() if user.get_full_name() else user.username'}
|
||||
}
|
||||
|
||||
RELEASE_LEVEL_FINAL = 1
|
||||
RELEASE_LEVEL_ALPHA = 2
|
||||
RELEASE_LEVEL_BETA = 3
|
||||
|
||||
@@ -44,7 +44,7 @@ from .permissions import (PERMISSION_DOCUMENT_CREATE,
|
||||
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_VERSION_REVERT,
|
||||
PERMISSION_DOCUMENT_TYPE_EDIT, PERMISSION_DOCUMENT_TYPE_DELETE,
|
||||
PERMISSION_DOCUMENT_TYPE_CREATE, PERMISSION_DOCUMENT_TYPE_VIEW)
|
||||
from .literals import (HISTORY_DOCUMENT_CREATED,
|
||||
from .events import (HISTORY_DOCUMENT_CREATED,
|
||||
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
|
||||
from .forms import (DocumentTypeSelectForm,
|
||||
DocumentForm_edit, DocumentPropertiesForm,
|
||||
|
||||
@@ -13,7 +13,7 @@ from django.db import transaction
|
||||
from converter.api import get_available_transformations_choices
|
||||
from converter.literals import DIMENSION_SEPARATOR
|
||||
from documents.models import DocumentType, Document
|
||||
from documents.literals import HISTORY_DOCUMENT_CREATED
|
||||
from documents.events import HISTORY_DOCUMENT_CREATED
|
||||
from document_indexing.api import update_indexes
|
||||
from history.api import create_history
|
||||
from metadata.models import MetadataType
|
||||
|
||||
Reference in New Issue
Block a user