Ensure that the automatic index is created after the default document type is created.

This commit is contained in:
Roberto Rosario
2016-05-17 05:02:57 -04:00
parent 0bebef5ba9
commit c97208f609
5 changed files with 36 additions and 20 deletions

View File

@@ -3,6 +3,9 @@ from __future__ import unicode_literals
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from .literals import DEFAULT_DOCUMENT_TYPE_LABEL
from .signals import post_initial_document_type
def create_default_document_type(sender, **kwargs):
DocumentType = apps.get_model(
@@ -10,4 +13,9 @@ def create_default_document_type(sender, **kwargs):
)
if not DocumentType.objects.count():
DocumentType.objects.create(label=_('Default'))
document_type = DocumentType.objects.create(
label=DEFAULT_DOCUMENT_TYPE_LABEL
)
post_initial_document_type.send(
sender=DocumentType, instance=document_type
)

View File

@@ -11,6 +11,7 @@ DELETE_STALE_STUBS_INTERVAL = 60 * 10 # 10 minutes
DEFAULT_DELETE_PERIOD = 30
DEFAULT_DELETE_TIME_UNIT = TIME_DELTA_UNIT_DAYS
DEFAULT_ZIP_FILENAME = 'document_bundle.zip'
DEFAULT_DOCUMENT_TYPE_LABEL = _('Default')
DOCUMENT_IMAGE_TASK_TIMEOUT = 20
STUB_EXPIRATION_INTERVAL = 60 * 60 * 24 # 24 hours
UPDATE_PAGE_COUNT_RETRY_DELAY = 10

View File

@@ -7,3 +7,6 @@ post_document_type_change = Signal(
providing_args=('instance',), use_caching=True
)
post_document_created = Signal(providing_args=('instance',), use_caching=True)
post_initial_document_type = Signal(
providing_args=('instance',), use_caching=True
)