Multiple apps: Sort imports and minor style fixes

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-06 16:38:24 -04:00
parent 4d84b5f28f
commit 46cd7353dc
117 changed files with 500 additions and 346 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ from .permissions import (
)
from .serializers import (
NewWorkflowDocumentTypeSerializer, WorkflowDocumentTypeSerializer,
WorkflowInstanceSerializer, WorkflowInstanceLogEntrySerializer,
WorkflowInstanceLogEntrySerializer, WorkflowInstanceSerializer,
WorkflowSerializer, WorkflowStateSerializer, WorkflowTransitionSerializer,
WritableWorkflowInstanceLogEntrySerializer, WritableWorkflowSerializer,
WritableWorkflowTransitionSerializer
+10 -9
View File
@@ -24,22 +24,23 @@ from .handlers import (
handler_index_document, handler_trigger_transition, launch_workflow
)
from .links import (
link_document_workflow_instance_list, link_setup_workflow_document_types,
link_setup_workflow_create, link_setup_workflow_delete,
link_document_workflow_instance_list, link_setup_workflow_create,
link_setup_workflow_delete, link_setup_workflow_document_types,
link_setup_workflow_edit, link_setup_workflow_list,
link_setup_workflow_states, link_setup_workflow_state_action_delete,
link_setup_workflow_state_action_delete,
link_setup_workflow_state_action_edit,
link_setup_workflow_state_action_list,
link_setup_workflow_state_action_selection,
link_setup_workflow_state_create, link_setup_workflow_state_delete,
link_setup_workflow_state_edit, link_setup_workflow_transitions,
link_setup_workflow_state_edit, link_setup_workflow_states,
link_setup_workflow_transition_create,
link_setup_workflow_transition_delete, link_setup_workflow_transition_edit,
link_tool_launch_all_workflows, link_workflow_instance_detail,
link_workflow_instance_transition, link_workflow_document_list,
link_workflow_list, link_workflow_preview,
link_workflow_state_document_list, link_workflow_state_list,
link_workflow_instance_transition_events
link_setup_workflow_transitions, link_tool_launch_all_workflows,
link_workflow_document_list, link_workflow_instance_detail,
link_workflow_instance_transition,
link_workflow_instance_transition_events, link_workflow_list,
link_workflow_preview, link_workflow_state_document_list,
link_workflow_state_list
)
from .permissions import (
permission_workflow_delete, permission_workflow_edit,
+1 -1
View File
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
from importlib import import_module
import logging
from importlib import import_module
from django.apps import apps
from django.utils import six
+1 -1
View File
@@ -14,7 +14,7 @@ from .icons import (
from .permissions import (
permission_workflow_create, permission_workflow_delete,
permission_workflow_edit, permission_workflow_tools,
permission_workflow_view,
permission_workflow_view
)
link_document_workflow_instance_list = Link(
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -15,10 +14,10 @@ class Migration(migrations.Migration):
model_name='workflowstate',
name='completion',
field=models.IntegerField(
default=0, help_text='Enter the percent of completion that '
'this state represents in relation to the workflow. Use '
'numbers without the percent sign.', verbose_name='Completion',
blank=True
blank=True, default=0, help_text='Enter the percent of '
'completion that this state represents in relation to the '
'workflow. Use numbers without the percent sign.',
verbose_name='Completion',
),
preserve_default=True,
),
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-25 04:47
from __future__ import unicode_literals
from django.db import migrations
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-03 18:26
from __future__ import unicode_literals
from django.db import migrations, models
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-03 06:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -17,8 +15,19 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='WorkflowTransitionTriggerEvent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('stored_event_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trigger_events', to='events.EventType', verbose_name='Event type')),
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'stored_event_type', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='trigger_events', to='events.EventType',
verbose_name='Event type'
)
),
],
options={
'verbose_name': 'Workflow transition trigger event',
@@ -28,16 +37,29 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='workflowtransition',
name='trigger_time_period',
field=models.PositiveIntegerField(blank=True, help_text='Amount of time after which this transition will trigger on its own.', null=True, verbose_name='Trigger time period'),
field=models.PositiveIntegerField(
blank=True, help_text='Amount of time after which this '
'transition will trigger on its own.', null=True,
verbose_name='Trigger time period'
),
),
migrations.AddField(
model_name='workflowtransition',
name='trigger_time_unit',
field=models.CharField(blank=True, choices=[('days', 'Days'), ('hours', 'Hours'), ('minutes', 'Minutes')], max_length=8, null=True, verbose_name='Trigger time unit'),
field=models.CharField(
blank=True, choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes')
], max_length=8, null=True, verbose_name='Trigger time unit'
),
),
migrations.AddField(
model_name='workflowtransitiontriggerevent',
name='transition',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='document_states.WorkflowTransition', verbose_name='Transition'),
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to='document_states.WorkflowTransition',
verbose_name='Transition'
),
),
]
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-03 06:51
from __future__ import unicode_literals
from django.db import migrations
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-03 07:28
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
@@ -17,16 +15,28 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='workflowinstancelogentry',
name='user',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'),
field=models.ForeignKey(
blank=True, null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL, verbose_name='User'
),
),
migrations.AlterField(
model_name='workflowtransitiontriggerevent',
name='event_type',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.EventType', verbose_name='Event type'),
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to='events.EventType', verbose_name='Event type'
),
),
migrations.AlterField(
model_name='workflowtransitiontriggerevent',
name='transition',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trigger_events', to='document_states.WorkflowTransition', verbose_name='Transition'),
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='trigger_events',
to='document_states.WorkflowTransition',
verbose_name='Transition'
),
),
]
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-03 07:52
from __future__ import unicode_literals
from django.db import migrations
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-07 06:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -16,13 +14,49 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='WorkflowStateAction',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('label', models.CharField(max_length=255, verbose_name='Label')),
('enabled', models.BooleanField(default=True, verbose_name='Enabled')),
('when', models.PositiveIntegerField(choices=[(1, 'On entry'), (2, 'On exit')], default=1, help_text='At which moment of the state this action will execute', verbose_name='When')),
('action_path', models.CharField(help_text='The dotted Python path to the workflow action class to execute.', max_length=128, verbose_name='Entry action path')),
('action_data', models.TextField(blank=True, verbose_name='Entry action data')),
('state', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='actions', to='document_states.WorkflowState', verbose_name='Workflow state')),
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'label', models.CharField(
max_length=255, verbose_name='Label'
)
),
(
'enabled', models.BooleanField(
default=True, verbose_name='Enabled'
)
),
(
'when', models.PositiveIntegerField(
choices=[(1, 'On entry'), (2, 'On exit')], default=1,
help_text='At which moment of the state this action '
'will execute', verbose_name='When'
)
),
(
'action_path', models.CharField(
help_text='The dotted Python path to the workflow '
'action class to execute.', max_length=128,
verbose_name='Entry action path'
)
),
(
'action_data', models.TextField(
blank=True, verbose_name='Entry action data'
)
),
(
'state', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='actions',
to='document_states.WorkflowState',
verbose_name='Workflow state'
)
),
],
options={
'ordering': ('label',),
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-10 17:17
from __future__ import unicode_literals
from django.db import migrations
@@ -14,6 +12,10 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='workflowinstancelogentry',
options={'ordering': ('datetime',), 'verbose_name': 'Workflow instance log entry', 'verbose_name_plural': 'Workflow instance log entries'},
options={
'ordering': ('datetime',),
'verbose_name': 'Workflow instance log entry',
'verbose_name_plural': 'Workflow instance log entries'
},
),
]
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-15 00:29
from __future__ import unicode_literals
from django.db import migrations
@@ -14,6 +12,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='workflowinstance',
options={'ordering': ('workflow',), 'verbose_name': 'Workflow instance', 'verbose_name_plural': 'Workflow instances'},
options={
'ordering': ('workflow',), 'verbose_name': 'Workflow instance',
'verbose_name_plural': 'Workflow instances'
},
),
]
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-08-23 23:53
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,6 +13,9 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='workflowstateaction',
name='label',
field=models.CharField(help_text='A simple identifier for this action.', max_length=255, verbose_name='Label'),
field=models.CharField(
help_text='A simple identifier for this action.',
max_length=255, verbose_name='Label'
),
),
]
+3 -3
View File
@@ -9,8 +9,8 @@ from graphviz import Digraph
from django.conf import settings
from django.core import serializers
from django.core.files.base import ContentFile
from django.core.exceptions import PermissionDenied, ValidationError
from django.core.files.base import ContentFile
from django.db import IntegrityError, models
from django.db.models import F, Max, Q
from django.urls import reverse
@@ -25,8 +25,8 @@ from mayan.apps.events.models import StoredEventType
from .error_logs import error_log_state_actions
from .literals import (
WORKFLOW_ACTION_WHEN_CHOICES, WORKFLOW_ACTION_ON_ENTRY,
WORKFLOW_ACTION_ON_EXIT
WORKFLOW_ACTION_ON_ENTRY, WORKFLOW_ACTION_ON_EXIT,
WORKFLOW_ACTION_WHEN_CHOICES
)
from .managers import WorkflowManager
from .permissions import permission_workflow_transition
-1
View File
@@ -4,7 +4,6 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.task_manager.classes import CeleryQueue
queue_document_states = CeleryQueue(
name='document_states', label=_('Document states')
)
+2 -2
View File
@@ -3,9 +3,9 @@ from __future__ import unicode_literals
from ..models import Workflow, WorkflowState, WorkflowTransition
from .literals import (
TEST_WORKFLOW_INITIAL_STATE_LABEL, TEST_WORKFLOW_INITIAL_STATE_COMPLETION,
TEST_WORKFLOW_INITIAL_STATE_COMPLETION, TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_LABEL,
TEST_WORKFLOW_STATE_LABEL, TEST_WORKFLOW_STATE_COMPLETION,
TEST_WORKFLOW_STATE_COMPLETION, TEST_WORKFLOW_STATE_LABEL,
TEST_WORKFLOW_TRANSITION_LABEL, TEST_WORKFLOW_TRANSITION_LABEL_2
)
+6 -6
View File
@@ -19,12 +19,12 @@ from ..permissions import (
)
from .literals import (
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_INITIAL_STATE_COMPLETION,
TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INSTANCE_LOG_ENTRY_COMMENT, TEST_WORKFLOW_LABEL,
TEST_WORKFLOW_LABEL_EDITED, TEST_WORKFLOW_STATE_COMPLETION,
TEST_WORKFLOW_STATE_LABEL, TEST_WORKFLOW_STATE_LABEL_EDITED,
TEST_WORKFLOW_TRANSITION_LABEL, TEST_WORKFLOW_TRANSITION_LABEL_EDITED
TEST_WORKFLOW_INITIAL_STATE_COMPLETION, TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INSTANCE_LOG_ENTRY_COMMENT, TEST_WORKFLOW_INTERNAL_NAME,
TEST_WORKFLOW_LABEL, TEST_WORKFLOW_LABEL_EDITED,
TEST_WORKFLOW_STATE_COMPLETION, TEST_WORKFLOW_STATE_LABEL,
TEST_WORKFLOW_STATE_LABEL_EDITED, TEST_WORKFLOW_TRANSITION_LABEL,
TEST_WORKFLOW_TRANSITION_LABEL_EDITED
)
@@ -3,19 +3,19 @@ from __future__ import unicode_literals
from django.test import override_settings
from mayan.apps.common.tests import BaseTestCase
from mayan.apps.document_indexing.models import Index, IndexInstanceNode
from mayan.apps.documents.models import DocumentType
from mayan.apps.documents.tests import (
TEST_SMALL_DOCUMENT_PATH, TEST_DOCUMENT_TYPE_LABEL
TEST_DOCUMENT_TYPE_LABEL, TEST_SMALL_DOCUMENT_PATH
)
from mayan.apps.document_indexing.models import Index, IndexInstanceNode
from ..models import Workflow
from .literals import (
TEST_INDEX_LABEL, TEST_INDEX_TEMPLATE_METADATA_EXPRESSION,
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INITIAL_STATE_COMPLETION, TEST_WORKFLOW_LABEL,
TEST_WORKFLOW_STATE_LABEL, TEST_WORKFLOW_STATE_COMPLETION,
TEST_WORKFLOW_INITIAL_STATE_COMPLETION, TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_LABEL,
TEST_WORKFLOW_STATE_COMPLETION, TEST_WORKFLOW_STATE_LABEL,
TEST_WORKFLOW_TRANSITION_LABEL
)
@@ -2,22 +2,22 @@ from __future__ import unicode_literals
from mayan.apps.common.tests import GenericViewTestCase
from mayan.apps.documents.tests import (
GenericDocumentViewTestCase, TEST_SMALL_DOCUMENT_PATH
TEST_SMALL_DOCUMENT_PATH, GenericDocumentViewTestCase
)
from ..models import Workflow, WorkflowState, WorkflowTransition
from ..permissions import (
permission_workflow_create, permission_workflow_delete,
permission_workflow_edit, permission_workflow_view,
permission_workflow_tools, permission_workflow_transition
permission_workflow_edit, permission_workflow_tools,
permission_workflow_transition, permission_workflow_view
)
from .literals import (
TEST_WORKFLOW_INITIAL_STATE_LABEL, TEST_WORKFLOW_INITIAL_STATE_COMPLETION,
TEST_WORKFLOW_INITIAL_STATE_COMPLETION, TEST_WORKFLOW_INITIAL_STATE_LABEL,
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_LABEL,
TEST_WORKFLOW_LABEL_EDITED, TEST_WORKFLOW_STATE_LABEL,
TEST_WORKFLOW_STATE_LABEL_EDITED, TEST_WORKFLOW_STATE_COMPLETION,
TEST_WORKFLOW_TRANSITION_LABEL, TEST_WORKFLOW_TRANSITION_LABEL_EDITED,
TEST_WORKFLOW_LABEL_EDITED, TEST_WORKFLOW_STATE_COMPLETION,
TEST_WORKFLOW_STATE_LABEL, TEST_WORKFLOW_STATE_LABEL_EDITED,
TEST_WORKFLOW_TRANSITION_LABEL, TEST_WORKFLOW_TRANSITION_LABEL_EDITED
)
from .mixins import WorkflowTestMixin
+8 -8
View File
@@ -5,10 +5,10 @@ from django.conf.urls import url
from .api_views import (
APIDocumentTypeWorkflowListView, APIWorkflowDocumentTypeList,
APIWorkflowDocumentTypeView, APIWorkflowImageView,
APIWorkflowInstanceListView, APIWorkflowInstanceView,
APIWorkflowInstanceLogEntryListView, APIWorkflowListView,
APIWorkflowStateListView, APIWorkflowStateView,
APIWorkflowTransitionListView, APIWorkflowTransitionView, APIWorkflowView
APIWorkflowInstanceListView, APIWorkflowInstanceLogEntryListView,
APIWorkflowInstanceView, APIWorkflowListView, APIWorkflowStateListView,
APIWorkflowStateView, APIWorkflowTransitionListView,
APIWorkflowTransitionView, APIWorkflowView
)
from .views import (
DocumentWorkflowInstanceListView, SetupWorkflowCreateView,
@@ -18,13 +18,13 @@ from .views import (
SetupWorkflowStateActionEditView, SetupWorkflowStateActionListView,
SetupWorkflowStateActionSelectionView, SetupWorkflowStateCreateView,
SetupWorkflowStateDeleteView, SetupWorkflowStateEditView,
SetupWorkflowStateListView, SetupWorkflowTransitionListView,
SetupWorkflowTransitionCreateView, SetupWorkflowTransitionDeleteView,
SetupWorkflowTransitionEditView,
SetupWorkflowStateListView, SetupWorkflowTransitionCreateView,
SetupWorkflowTransitionDeleteView, SetupWorkflowTransitionEditView,
SetupWorkflowTransitionListView,
SetupWorkflowTransitionTriggerEventListView, ToolLaunchAllWorkflows,
WorkflowDocumentListView, WorkflowInstanceDetailView,
WorkflowInstanceTransitionView, WorkflowListView, WorkflowPreviewView,
WorkflowStateDocumentListView, WorkflowStateListView,
WorkflowStateDocumentListView, WorkflowStateListView
)
urlpatterns = [
+5 -6
View File
@@ -32,18 +32,17 @@ from .icons import (
icon_workflow_transition
)
from .links import (
link_setup_workflow_create, link_setup_workflow_state_create,
link_setup_workflow_state_action_selection,
link_setup_workflow_transition_create
link_setup_workflow_create, link_setup_workflow_state_action_selection,
link_setup_workflow_state_create, link_setup_workflow_transition_create
)
from .models import (
Workflow, WorkflowInstance, WorkflowState, WorkflowStateAction,
WorkflowTransition, WorkflowRuntimeProxy, WorkflowStateRuntimeProxy,
Workflow, WorkflowInstance, WorkflowRuntimeProxy, WorkflowState,
WorkflowStateAction, WorkflowStateRuntimeProxy, WorkflowTransition
)
from .permissions import (
permission_workflow_create, permission_workflow_delete,
permission_workflow_edit, permission_workflow_tools,
permission_workflow_view,
permission_workflow_view
)
from .tasks import task_launch_all_workflows
@@ -1,7 +1,7 @@
from __future__ import absolute_import, unicode_literals
import logging
import json
import logging
from jinja2 import Template
import requests