Code cleanups

PEP8 cleanups. Add keyword arguments.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-05-21 00:56:22 -04:00
parent fbe0e14b82
commit 4baeb6ce7e
219 changed files with 1891 additions and 507 deletions

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-24 07:37
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def move_from_content_type_user_to_foreign_key_field_user(apps, schema_editor):
def operation_move_from_content_type_user_to_foreign_key_field_user(apps, schema_editor):
# The model references the use who checked out the document using a
# generic.GenericForeignKey. This migrations changes that to a simpler
# ForeignKey to the User model
DocumentCheckout = apps.get_model('checkouts', 'DocumentCheckout')
DocumentCheckout = apps.get_model(
app_label='checkouts', model_name='DocumentCheckout'
)
for document_checkout in DocumentCheckout.objects.using(schema_editor.connection.alias).all():
document_checkout.user = document_checkout.user_object
@@ -24,6 +25,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RunPython(
move_from_content_type_user_to_foreign_key_field_user
code=operation_move_from_content_type_user_to_foreign_key_field_user
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
@@ -14,6 +13,8 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='documentcheckout',
name='document',
field=models.OneToOneField(verbose_name='Document', to='documents.Document'),
field=models.OneToOneField(
verbose_name='Document', to='documents.Document'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-22 05:34
from __future__ import unicode_literals
from django.db import migrations, models
@@ -17,8 +15,18 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='NewVersionBlock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='documents.Document', verbose_name='Document')),
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'document', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to='documents.Document', verbose_name='Document'
)
),
],
options={
'verbose_name': 'New version block',

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-10 17:15
from __future__ import unicode_literals
from django.db import migrations
@@ -14,6 +12,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='documentcheckout',
options={'ordering': ('pk',), 'verbose_name': 'Document checkout', 'verbose_name_plural': 'Document checkouts'},
options={
'ordering': ('pk',), 'verbose_name': 'Document checkout',
'verbose_name_plural': 'Document checkouts'
},
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-25 06:52
from __future__ import unicode_literals
from django.db import migrations, models
@@ -17,12 +15,41 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='ErrorLogEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('namespace', models.CharField(max_length=128, verbose_name='Namespace')),
('object_id', models.PositiveIntegerField(blank=True, null=True)),
('datetime', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Date time')),
('result', models.TextField(blank=True, null=True, verbose_name='Result')),
('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='error_log_content_type', to='contenttypes.ContentType')),
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'namespace', models.CharField(
max_length=128, verbose_name='Namespace'
)
),
(
'object_id', models.PositiveIntegerField(
blank=True, null=True
)
),
(
'datetime', models.DateTimeField(
auto_now_add=True, db_index=True,
verbose_name='Date time'
)
),
(
'result', models.TextField(
blank=True, null=True, verbose_name='Result'
)
),
(
'content_type', models.ForeignKey(
blank=True, null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='error_log_content_type',
to='contenttypes.ContentType'
)
),
],
options={
'ordering': ('datetime',),

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-03 07:02
from __future__ import unicode_literals
import mayan.apps.common.models
@@ -17,6 +15,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='shareduploadedfile',
name='file',
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location=b'mayan/media/shared_files'), upload_to=mayan.apps.common.models.upload_to, verbose_name='File'),
field=models.FileField(
storage=django.core.files.storage.FileSystemStorage(
location=b'mayan/media/shared_files'
), upload_to=mayan.apps.common.models.upload_to,
verbose_name='File'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-29 07:58
from __future__ import unicode_literals
import mayan.apps.common.models
@@ -17,6 +15,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='shareduploadedfile',
name='file',
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location=b'/home/rosarior/development/mayan-edms/mayan/media/shared_files'), upload_to=mayan.apps.common.models.upload_to, verbose_name='File'),
field=models.FileField(
storage=django.core.files.storage.FileSystemStorage(
location=b'/home/rosarior/development/mayan-edms/mayan/media/shared_files'
), upload_to=mayan.apps.common.models.upload_to,
verbose_name='File'
),
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
@@ -41,7 +40,9 @@ class Migration(migrations.Migration):
(
'arguments', models.TextField(
blank=True, null=True, verbose_name='Arguments',
validators=[mayan.apps.converter.validators.YAMLValidator]
validators=[
mayan.apps.converter.validators.YAMLValidator
]
)
),
(

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-18 17:58
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,6 +13,21 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='transformation',
name='name',
field=models.CharField(choices=[('crop', 'Crop: left, top, right, bottom'), ('flip', 'Flip'), ('gaussianblur', 'Gaussian blur: radius'), ('mirror', 'Mirror'), ('resize', 'Resize: width, height'), ('rotate', 'Rotate: degrees'), ('rotate180', 'Rotate 180 degrees'), ('rotate270', 'Rotate 270 degrees'), ('rotate90', 'Rotate 90 degrees'), ('unsharpmask', 'Unsharp masking: radius, percent, threshold'), ('zoom', 'Zoom: percent')], max_length=128, verbose_name='Name'),
field=models.CharField(
choices=[
('crop', 'Crop: left, top, right, bottom'),
('flip', 'Flip'),
('gaussianblur', 'Gaussian blur: radius'),
('mirror', 'Mirror'), ('resize', 'Resize: width, height'),
('rotate', 'Rotate: degrees'),
('rotate180', 'Rotate 180 degrees'),
('rotate270', 'Rotate 270 degrees'),
('rotate90', 'Rotate 90 degrees'),
(
'unsharpmask',
'Unsharp masking: radius, percent, threshold'
), ('zoom', 'Zoom: percent')
], max_length=128, verbose_name='Name'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-14 21:33
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,6 +13,22 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='transformation',
name='name',
field=models.CharField(choices=[('crop', 'Crop: left, top, right, bottom'), ('flip', 'Flip'), ('gaussianblur', 'Gaussian blur: radius'), ('lineart', 'Line art'), ('mirror', 'Mirror'), ('resize', 'Resize: width, height'), ('rotate', 'Rotate: degrees'), ('rotate180', 'Rotate 180 degrees'), ('rotate270', 'Rotate 270 degrees'), ('rotate90', 'Rotate 90 degrees'), ('unsharpmask', 'Unsharp masking: radius, percent, threshold'), ('zoom', 'Zoom: percent')], max_length=128, verbose_name='Name'),
field=models.CharField(
choices=[
('crop', 'Crop: left, top, right, bottom'),
('flip', 'Flip'),
('gaussianblur', 'Gaussian blur: radius'),
('lineart', 'Line art'), ('mirror', 'Mirror'),
('resize', 'Resize: width, height'),
('rotate', 'Rotate: degrees'),
('rotate180', 'Rotate 180 degrees'),
('rotate270', 'Rotate 270 degrees'),
('rotate90', 'Rotate 90 degrees'),
(
'unsharpmask',
'Unsharp masking: radius, percent, threshold'
), ('zoom', 'Zoom: percent')
], max_length=128, verbose_name='Name'
),
),
]

View File

@@ -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,22 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='transformation',
name='name',
field=models.CharField(choices=[('crop', 'Crop: left, top, right, bottom'), ('flip', 'Flip'), ('gaussianblur', 'Gaussian blur: radius'), ('lineart', 'Line art'), ('mirror', 'Mirror'), ('resize', 'Resize: width, height'), ('rotate', 'Rotate: degrees, fillcolor'), ('rotate180', 'Rotate 180 degrees'), ('rotate270', 'Rotate 270 degrees'), ('rotate90', 'Rotate 90 degrees'), ('unsharpmask', 'Unsharp masking: radius, percent, threshold'), ('zoom', 'Zoom: percent')], max_length=128, verbose_name='Name'),
field=models.CharField(
choices=[
('crop', 'Crop: left, top, right, bottom'),
('flip', 'Flip'),
('gaussianblur', 'Gaussian blur: radius'),
('lineart', 'Line art'), ('mirror', 'Mirror'),
('resize', 'Resize: width, height'),
('rotate', 'Rotate: degrees, fillcolor'),
('rotate180', 'Rotate 180 degrees'),
('rotate270', 'Rotate 270 degrees'),
('rotate90', 'Rotate 90 degrees'),
(
'unsharpmask',
'Unsharp masking: radius, percent, threshold'
), ('zoom', 'Zoom: percent')
], max_length=128, verbose_name='Name'
),
),
]

View File

@@ -173,7 +173,8 @@ class Dependency(object):
for dependency in cls.get_all():
print('* ', end='')
print(template.format(
print(
template.format(
dependency.name,
force_text(dependency.class_name_verbose_name),
force_text(dependency.get_version_string()),

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.core import management
from django.utils.translation import ugettext_lazy as _
from ...classes import PythonDependency, DependencyGroup
from ...classes import PythonDependency
class Command(management.BaseCommand):

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
def migrate_old_comments(apps, schema_editor):
def operation_migrate_old_comments(apps, schema_editor):
# https://code.djangoproject.com/ticket/24282
# If someone has a better solution until Django 1.8, would appreciate
# a pull-request :)
@@ -17,13 +16,19 @@ def migrate_old_comments(apps, schema_editor):
pass
else:
Comment = apps.get_model('document_comments', 'Comment')
Document = apps.get_model('documents', 'Document')
Comment = apps.get_model(
app_label='document_comments', model_name='Comment'
)
Document = apps.get_model(
app_label='documents', model_name='Document'
)
User = apps.get_model(*settings.AUTH_USER_MODEL.split('.'))
for old_comment in OldComment.objects.using(schema_editor.connection.alias).all():
comment = Comment(
document=Document.objects.using(schema_editor.connection.alias).get(pk=old_comment.object_pk),
document=Document.objects.using(
schema_editor.connection.alias
).get(pk=old_comment.object_pk),
user=User(old_comment.user.pk),
comment=old_comment.comment,
submit_date=old_comment.submit_date,
@@ -42,5 +47,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(migrate_old_comments),
migrations.RunPython(code=operation_migrate_old_comments),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.template.defaultfilters import slugify
def assign_slugs(apps, schema_editor):
Index = apps.get_model('document_indexing', 'Index')
def operation_assign_slugs(apps, schema_editor):
Index = apps.get_model(app_label='document_indexing', model_name='Index')
for index in Index.objects.using(schema_editor.connection.alias).all():
index.slug = slugify(index.label)
@@ -20,5 +19,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(assign_slugs),
migrations.RunPython(code=operation_assign_slugs),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-24 04:56
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-30 07:28
from __future__ import unicode_literals
from django.db import migrations, models
@@ -16,16 +14,27 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='index',
name='slug',
field=models.SlugField(help_text='This value will be used by other apps to reference this index.', max_length=128, unique=True, verbose_name='Slug'),
field=models.SlugField(
help_text='This value will be used by other apps to reference '
'this index.', max_length=128, unique=True, verbose_name='Slug'
),
),
migrations.AlterField(
model_name='indexinstancenode',
name='documents',
field=models.ManyToManyField(related_name='index_instance_nodes', to='documents.Document', verbose_name='Documents'),
field=models.ManyToManyField(
related_name='index_instance_nodes', to='documents.Document',
verbose_name='Documents'
),
),
migrations.AlterField(
model_name='indexinstancenode',
name='index_template_node',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='index_instance_nodes', to='document_indexing.IndexTemplateNode', verbose_name='Index template node'),
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='index_instance_nodes',
to='document_indexing.IndexTemplateNode',
verbose_name='Index template node'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-14 21:33
from __future__ import unicode_literals
from django.db import migrations
@@ -14,6 +12,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name='index',
options={'ordering': ('label',), 'verbose_name': 'Index', 'verbose_name_plural': 'Indexes'},
options={
'ordering': ('label',), 'verbose_name': 'Index',
'verbose_name_plural': 'Indexes'
},
),
]

View File

@@ -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,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='indextemplatenode',
name='expression',
field=models.TextField(help_text="Enter a template to render. Use Django's default templating language (https://docs.djangoproject.com/en/1.11/ref/templates/builtins/)", verbose_name='Indexing expression'),
field=models.TextField(
help_text="Enter a template to render. Use Django's default "
"templating language "
"(https://docs.djangoproject.com/en/1.11/ref/templates/builtins/)",
verbose_name='Indexing expression'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-29 19:22
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,6 +13,9 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='index',
name='document_types',
field=models.ManyToManyField(related_name='indexes', to='documents.DocumentType', verbose_name='Document types'),
field=models.ManyToManyField(
related_name='indexes', to='documents.DocumentType',
verbose_name='Document types'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-23 18:55
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-27 16:17
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,29 +1,39 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-10 06:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def create_parsing_setting_for_existing_document_types(apps, schema_editor):
DocumentType = apps.get_model('documents', 'DocumentType')
DocumentTypeSettings = apps.get_model('document_parsing', 'DocumentTypeSettings')
def operation_create_parsing_setting_for_existing_document_types(apps, schema_editor):
DocumentType = apps.get_model(
app_label='documents', model_name='DocumentType'
)
DocumentTypeSettings = apps.get_model(
app_label='document_parsing', model_name='DocumentTypeSettings'
)
for document_type in DocumentType.objects.using(schema_editor.connection.alias).all():
try:
DocumentTypeSettings.objects.using(schema_editor.connection.alias).create(document_type=document_type)
DocumentTypeSettings.objects.using(
schema_editor.connection.alias
).create(document_type=document_type)
except DocumentTypeSettings.DoesNotExist:
pass
def delete_parsing_setting_for_existing_document_types(apps, schema_editor):
DocumentType = apps.get_model('documents', 'DocumentType')
DocumentTypeSettings = apps.get_model('document_parsing', 'DocumentTypeSettings')
def operation_delete_parsing_setting_for_existing_document_types(apps, schema_editor):
DocumentType = apps.get_model(
app_label='documents', model_name='DocumentType'
)
DocumentTypeSettings = apps.get_model(
app_label='document_parsing', model_name='DocumentTypeSettings'
)
for document_type in DocumentType.objects.using(schema_editor.connection.alias).all():
try:
DocumentTypeSettings.objects.using(schema_editor.connection.alias).get(document_type=document_type).delete()
DocumentTypeSettings.objects.using(
schema_editor.connection.alias
).get(document_type=document_type).delete()
except DocumentTypeSettings.DoesNotExist:
pass
@@ -39,9 +49,26 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='DocumentTypeSettings',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('auto_parsing', models.BooleanField(default=True, verbose_name='Automatically queue newly created documents for parsing.')),
('document_type', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='parsing_settings', to='documents.DocumentType', verbose_name='Document type')),
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'auto_parsing', models.BooleanField(
default=True, verbose_name='Automatically queue '
'newly created documents for parsing.'
)
),
(
'document_type', models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name='parsing_settings',
to='documents.DocumentType',
verbose_name='Document type'
)
),
],
options={
'verbose_name': 'Document type settings',
@@ -49,7 +76,7 @@ class Migration(migrations.Migration):
},
),
migrations.RunPython(
code=create_parsing_setting_for_existing_document_types,
reverse_code=delete_parsing_setting_for_existing_document_types,
code=operation_create_parsing_setting_for_existing_document_types,
reverse_code=operation_delete_parsing_setting_for_existing_document_types,
)
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:45
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,6 +13,9 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='documentpagecontent',
name='content',
field=models.TextField(blank=True, help_text='The actual text content as extracted by the document parsing backend.', verbose_name='Content'),
field=models.TextField(
blank=True, help_text='The actual text content as extracted '
'by the document parsing backend.', verbose_name='Content'
),
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
@@ -27,7 +26,8 @@ class Migration(migrations.Migration):
name='signature_file',
field=models.FileField(
storage=FileSystemStorage(),
upload_to=mayan.apps.document_signatures.models.upload_to, null=True,
upload_to=mayan.apps.document_signatures.models.upload_to,
null=True,
verbose_name='Signature file', blank=True
),
preserve_default=True,

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-03 07:02
from __future__ import unicode_literals
import django.core.files.storage
@@ -18,6 +16,12 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='detachedsignature',
name='signature_file',
field=models.FileField(blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(location=b'mayan/media/document_storage'), upload_to=mayan.apps.document_signatures.models.upload_to, verbose_name='Signature file'),
field=models.FileField(
blank=True, null=True,
storage=django.core.files.storage.FileSystemStorage(
location=b'mayan/media/document_storage'
), upload_to=mayan.apps.document_signatures.models.upload_to,
verbose_name='Signature file'
),
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-29 07:59
from __future__ import unicode_literals
import django.core.files.storage
@@ -19,10 +17,12 @@ class Migration(migrations.Migration):
model_name='detachedsignature',
name='signature_file',
field=models.FileField(
blank=True, null=True, storage=django.core.files.storage.FileSystemStorage(
blank=True, null=True,
storage=django.core.files.storage.FileSystemStorage(
location=b'/home/rosarior/development/mayan-edms/mayan/media/document_signatures'
),
upload_to=mayan.apps.document_signatures.models.upload_to, verbose_name='Signature file'
upload_to=mayan.apps.document_signatures.models.upload_to,
verbose_name='Signature file'
),
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -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

View File

@@ -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
@@ -8,8 +6,10 @@ from django.utils.text import slugify
from mayan.apps.common.validators import validate_internal_name
def generate_internal_name(apps, schema_editor):
Workflow = apps.get_model('document_states', 'Workflow')
def operation_generate_internal_name(apps, schema_editor):
Workflow = apps.get_model(
app_label='document_states', model_name='Workflow'
)
internal_names = []
for workflow in Workflow.objects.using(schema_editor.connection.alias).all():
@@ -50,7 +50,8 @@ class Migration(migrations.Migration):
# Generate the slugs based on the labels
migrations.RunPython(
generate_internal_name, reverse_code=migrations.RunPython.noop
code=operation_generate_internal_name,
reverse_code=migrations.RunPython.noop
),
# Make the internal name field unique

View File

@@ -1,5 +1,3 @@
# -*- 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
@@ -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'
),
),
]

View File

@@ -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

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-03 07:28
from __future__ import unicode_literals
from django.conf import settings
@@ -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'
),
),
]

View File

@@ -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

View File

@@ -1,5 +1,3 @@
# -*- 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
@@ -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',),

View File

@@ -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'
},
),
]

View File

@@ -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'
},
),
]

View File

@@ -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'
),
),
]

View File

@@ -4,18 +4,26 @@ from django.db import migrations
def operation_add_full_path(apps, schema_editor):
WorkflowStateAction = apps.get_model('document_states', 'WorkflowStateAction')
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.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('document_states', 'WorkflowStateAction')
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.action_path = workflow_state_action.action_path.replace(
'mayan.apps.', ''
)
workflow_state_action.save()
@@ -27,6 +35,7 @@ class Migration(migrations.Migration):
operations = [
migrations.RunPython(
operation_add_full_path, reverse_code=operation_remove_full_path
code=operation_add_full_path,
reverse_code=operation_remove_full_path
)
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,14 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
import uuid
from django.db import models, migrations
from django.core.files.storage import FileSystemStorage
from django.utils.encoding import force_text
import mayan.apps.documents.models
class Migration(migrations.Migration):

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def make_existing_documents_not_stubs(apps, schema_editor):
Document = apps.get_model('documents', 'Document')
def operation_make_existing_documents_not_stubs(apps, schema_editor):
Document = apps.get_model(app_label='documents', model_name='Document')
for document in Document.objects.using(schema_editor.connection.alias).all():
document.is_stub = False
@@ -27,5 +26,5 @@ class Migration(migrations.Migration):
),
preserve_default=True,
),
migrations.RunPython(make_existing_documents_not_stubs),
migrations.RunPython(code=operation_make_existing_documents_not_stubs),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations

Some files were not shown because too many files have changed in this diff Show More