Use the post initial setup signal to setup a default document type and a default document source
This commit is contained in:
@@ -15,6 +15,7 @@ from common import (
|
||||
)
|
||||
from common.api import register_maintenance_links
|
||||
from common.classes import ModelAttribute
|
||||
from common.signals import post_initial_setup
|
||||
from common.utils import encapsulate, validate_path
|
||||
from converter.links import link_transformation_list
|
||||
from converter.permissions import (
|
||||
@@ -29,6 +30,7 @@ from rest_api.classes import APIEndPoint
|
||||
from statistics.classes import StatisticNamespace
|
||||
|
||||
from documents import settings as document_settings
|
||||
from .handlers import create_default_document_type
|
||||
from .links import (
|
||||
link_clear_image_cache, link_document_acl_list,
|
||||
link_document_clear_transformations, link_document_content,
|
||||
@@ -146,6 +148,8 @@ class DocumentsApp(apps.AppConfig):
|
||||
namespace.add_statistic(DocumentStatistics(name='document_stats', label=_('Document tendencies')))
|
||||
namespace.add_statistic(DocumentUsageStatistics(name='document_usage', label=_('Document usage')))
|
||||
|
||||
post_initial_setup.connect(create_default_document_type, dispatch_uid='create_default_document_type')
|
||||
|
||||
registry.register(Document)
|
||||
|
||||
register_maintenance_links([link_clear_image_cache], namespace='documents', title=_('Documents'))
|
||||
|
||||
9
mayan/apps/documents/handlers.py
Normal file
9
mayan/apps/documents/handlers.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .models import DocumentType
|
||||
|
||||
|
||||
def create_default_document_type(sender, **kwargs):
|
||||
DocumentType.objects.create(name=_('Default'))
|
||||
@@ -7,6 +7,7 @@ from common import (
|
||||
MissingItem, menu_front_page, menu_object, menu_secondary, menu_sidebar,
|
||||
menu_setup
|
||||
)
|
||||
from common.signals import post_initial_setup
|
||||
from common.utils import encapsulate
|
||||
from converter.links import link_transformation_list
|
||||
from documents.models import Document
|
||||
@@ -14,6 +15,7 @@ from navigation.api import register_model_list_columns
|
||||
from rest_api.classes import APIEndPoint
|
||||
|
||||
from .classes import StagingFile
|
||||
from .handlers import create_default_document_source
|
||||
from .links import (
|
||||
link_document_create_multiple, link_document_create_siblings,
|
||||
link_setup_sources, link_setup_source_create_imap_email,
|
||||
@@ -49,3 +51,5 @@ class SourcesApp(apps.AppConfig):
|
||||
encapsulate(lambda x: staging_file_thumbnail(x, gallery_name='sources:staging_list', title=x.filename, size='100'))
|
||||
},
|
||||
])
|
||||
|
||||
post_initial_setup.connect(create_default_document_source, dispatch_uid='create_default_document_source')
|
||||
|
||||
10
mayan/apps/sources/handlers.py
Normal file
10
mayan/apps/sources/handlers.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .literals import SOURCE_UNCOMPRESS_CHOICE_ASK
|
||||
from .models import WebFormSource
|
||||
|
||||
|
||||
def create_default_document_source(sender, **kwargs):
|
||||
WebFormSource.objects.create(title=_('Default'), uncompress=SOURCE_UNCOMPRESS_CHOICE_ASK)
|
||||
Reference in New Issue
Block a user