Files
mayan-edms/mayan/apps/document_states/migrations/0013_auto_20190423_0810.py
Roberto Rosario 4baeb6ce7e Code cleanups
PEP8 cleanups. Add keyword arguments.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2019-05-21 00:56:22 -04:00

42 lines
1.2 KiB
Python

from __future__ import unicode_literals
from django.db import migrations
def operation_add_full_path(apps, schema_editor):
WorkflowStateAction = apps.get_model(
app_label='document_states', model_name='WorkflowStateAction'
)
for workflow_state_action in WorkflowStateAction.objects.using(schema_editor.connection.alias).all():
workflow_state_action.action_path = 'mayan.apps.{}'.format(
workflow_state_action.action_path
)
workflow_state_action.save()
def operation_remove_full_path(apps, schema_editor):
WorkflowStateAction = apps.get_model(
app_label='document_states', model_name='WorkflowStateAction'
)
for workflow_state_action in WorkflowStateAction.objects.using(schema_editor.connection.alias).all():
workflow_state_action.action_path = workflow_state_action.action_path.replace(
'mayan.apps.', ''
)
workflow_state_action.save()
class Migration(migrations.Migration):
dependencies = [
('document_states', '0012_auto_20180823_2353'),
]
operations = [
migrations.RunPython(
code=operation_add_full_path,
reverse_code=operation_remove_full_path
)
]