Only create the initial document type and web source if none exists.

This commit is contained in:
Roberto Rosario
2015-11-19 00:45:04 -04:00
parent 3d1d1fb44f
commit 1ad68a61f5
2 changed files with 6 additions and 4 deletions

View File

@@ -6,4 +6,5 @@ from .models import DocumentType
def create_default_document_type(sender, **kwargs):
DocumentType.objects.create(label=_('Default'))
if not DocumentType.objects.count():
DocumentType.objects.create(label=_('Default'))

View File

@@ -9,9 +9,10 @@ from .models import POP3Email, IMAPEmail, WatchFolderSource, WebFormSource
def create_default_document_source(sender, **kwargs):
WebFormSource.objects.create(
label=_('Default'), uncompress=SOURCE_UNCOMPRESS_CHOICE_ASK
)
if not WebFormSource.objects.count():
WebFormSource.objects.create(
label=_('Default'), uncompress=SOURCE_UNCOMPRESS_CHOICE_ASK
)
def copy_transformations_to_version(sender, **kwargs):