Documents, Mailer: Sort imports, minor style fix

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-07 17:19:08 -04:00
parent adab93fad6
commit ab1482152e
86 changed files with 9823 additions and 502 deletions

View File

@@ -17,25 +17,23 @@ from mayan.apps.rest_api.filters import MayanObjectPermissionsFilter
from mayan.apps.rest_api.permissions import MayanPermission
from .literals import DOCUMENT_IMAGE_TASK_TIMEOUT
from .models import (
Document, DocumentType, RecentDocument
)
from .models import Document, DocumentType, RecentDocument
from .permissions import (
permission_document_create, permission_document_delete,
permission_document_download, permission_document_edit,
permission_document_new_version, permission_document_properties_edit,
permission_document_restore, permission_document_trash,
permission_document_view, permission_document_type_create,
permission_document_type_delete, permission_document_type_edit,
permission_document_type_view, permission_document_version_revert,
permission_document_version_view
permission_document_type_create, permission_document_type_delete,
permission_document_type_edit, permission_document_type_view,
permission_document_version_revert, permission_document_version_view,
permission_document_view
)
from .serializers import (
DeletedDocumentSerializer, DocumentPageSerializer, DocumentSerializer,
DocumentTypeSerializer, DocumentVersionSerializer,
NewDocumentSerializer, NewDocumentVersionSerializer,
RecentDocumentSerializer, WritableDocumentSerializer,
WritableDocumentTypeSerializer, WritableDocumentVersionSerializer
DocumentTypeSerializer, DocumentVersionSerializer, NewDocumentSerializer,
NewDocumentVersionSerializer, RecentDocumentSerializer,
WritableDocumentSerializer, WritableDocumentTypeSerializer,
WritableDocumentVersionSerializer
)
from .settings import settings_document_page_image_cache_time
from .tasks import task_generate_document_page_image

View File

@@ -2,17 +2,19 @@ from __future__ import absolute_import, unicode_literals
from datetime import timedelta
from kombu import Exchange, Queue
from django.db.models.signals import post_delete, post_migrate
from django.utils.translation import ugettext_lazy as _
from kombu import Exchange, Queue
from mayan.apps.acls import ModelPermission
from mayan.apps.acls.links import link_acl_list
from mayan.apps.acls.permissions import permission_acl_edit, permission_acl_view
from mayan.apps.acls.permissions import (
permission_acl_edit, permission_acl_view
)
from mayan.apps.common import (
MayanAppConfig, MissingItem, menu_facet, menu_list_facet, menu_main,
menu_object, menu_secondary, menu_setup, menu_sidebar, menu_multi_item,
menu_multi_item, menu_object, menu_secondary, menu_setup, menu_sidebar,
menu_tools
)
from mayan.apps.common.classes import ModelField, Template
@@ -21,13 +23,12 @@ from mayan.apps.common.signals import post_initial_setup
from mayan.apps.common.widgets import TwoStateWidget
from mayan.apps.converter.links import link_transformation_list
from mayan.apps.converter.permissions import (
permission_transformation_create,
permission_transformation_delete, permission_transformation_edit,
permission_transformation_view,
permission_transformation_create, permission_transformation_delete,
permission_transformation_edit, permission_transformation_view
)
from mayan.apps.events import ModelEventType
from mayan.apps.events.links import (
link_events_for_object, link_object_event_types_user_subcriptions_list,
link_events_for_object, link_object_event_types_user_subcriptions_list
)
from mayan.apps.events.permissions import permission_events_view
from mayan.apps.navigation import SourceColumn
@@ -38,18 +39,17 @@ from .dashboard_widgets import (
DashboardWidgetDocumentPagesTotal, DashboardWidgetDocumentsInTrash,
DashboardWidgetDocumentsNewThisMonth,
DashboardWidgetDocumentsPagesNewThisMonth, DashboardWidgetDocumentsTotal,
DashboardWidgetDocumentsTypesTotal,
DashboardWidgetDocumentsTypesTotal
)
from .events import (
event_document_create, event_document_download,
event_document_create, event_document_download, event_document_new_version,
event_document_properties_edit, event_document_type_change,
event_document_type_created, event_document_type_edited,
event_document_new_version, event_document_version_revert,
event_document_view
event_document_version_revert, event_document_view
)
from .handlers import (
create_default_document_type, handler_create_document_cache,
handler_remove_empty_duplicates_lists, handler_scan_duplicates_for,
handler_remove_empty_duplicates_lists, handler_scan_duplicates_for
)
from .links import (
link_clear_image_cache, link_document_clear_transformations,
@@ -71,17 +71,18 @@ from .links import (
link_document_page_rotate_right, link_document_page_view,
link_document_page_view_reset, link_document_page_zoom_in,
link_document_page_zoom_out, link_document_pages, link_document_preview,
link_document_print, link_document_properties, link_document_quick_download,
link_document_restore, link_document_trash, link_document_type_create,
link_document_type_delete, link_document_type_edit,
link_document_type_filename_create, link_document_type_filename_delete,
link_document_type_filename_edit, link_document_type_filename_list,
link_document_type_list, link_document_type_setup,
link_document_update_page_count, link_document_version_download,
link_document_version_list, link_document_version_return_document,
link_document_version_return_list, link_document_version_revert,
link_document_version_view, link_duplicated_document_list,
link_duplicated_document_scan, link_trash_can_empty
link_document_print, link_document_properties,
link_document_quick_download, link_document_restore, link_document_trash,
link_document_type_create, link_document_type_delete,
link_document_type_edit, link_document_type_filename_create,
link_document_type_filename_delete, link_document_type_filename_edit,
link_document_type_filename_list, link_document_type_list,
link_document_type_setup, link_document_update_page_count,
link_document_version_download, link_document_version_list,
link_document_version_return_document, link_document_version_return_list,
link_document_version_revert, link_document_version_view,
link_duplicated_document_list, link_duplicated_document_scan,
link_trash_can_empty
)
from .literals import (
CHECK_DELETE_PERIOD_INTERVAL, CHECK_TRASH_PERIOD_INTERVAL,
@@ -100,7 +101,7 @@ from .permissions import (
)
from .queues import * # NOQA
# Just import to initialize the search models
from .search import document_search, document_page_search # NOQA
from .search import document_page_search, document_search # NOQA
from .signals import post_version_upload
from .statistics import * # NOQA
from .widgets import (

View File

@@ -7,16 +7,14 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.classes import DashboardWidgetNumeric
from .icons import (
icon_dashboard_documents_in_trash, icon_dashboard_document_types,
icon_dashboard_pages_per_month, icon_dashboard_new_documents_this_month,
icon_dashboard_document_types, icon_dashboard_documents_in_trash,
icon_dashboard_new_documents_this_month, icon_dashboard_pages_per_month,
icon_dashboard_total_document
)
from .permissions import (
permission_document_view, permission_document_type_view
)
from .statistics import (
new_document_pages_this_month, new_documents_this_month,
permission_document_type_view, permission_document_view
)
from .statistics import new_document_pages_this_month, new_documents_this_month
class DashboardWidgetDocumentPagesTotal(DashboardWidgetNumeric):

View File

@@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals
from django import forms
from .widgets import DocumentPagesCarouselWidget, DocumentPageImageWidget
from .widgets import DocumentPageImageWidget, DocumentPagesCarouselWidget
class DocumentField(forms.fields.Field):

View File

@@ -10,13 +10,9 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.acls.models import AccessControlList
from mayan.apps.common.forms import DetailForm
from .fields import (
DocumentField, DocumentPageField, DocumentVersionField
)
from .models import (
Document, DocumentType, DocumentTypeFilename
)
from .fields import DocumentField, DocumentPageField, DocumentVersionField
from .literals import DEFAULT_ZIP_FILENAME, PAGE_RANGE_ALL, PAGE_RANGE_CHOICES
from .models import Document, DocumentType, DocumentTypeFilename
from .permissions import permission_document_create
from .runtime import language_choices

View File

@@ -26,13 +26,13 @@ from .icons import (
)
from .permissions import (
permission_document_delete, permission_document_download,
permission_document_properties_edit, permission_document_print,
permission_document_print, permission_document_properties_edit,
permission_document_restore, permission_document_tools,
permission_document_version_revert, permission_document_view,
permission_document_trash, permission_document_type_create,
permission_document_type_delete, permission_document_type_edit,
permission_document_type_view, permission_empty_trash,
permission_document_version_view
permission_document_type_view, permission_document_version_revert,
permission_document_version_view, permission_document_view,
permission_empty_trash
)
from .settings import setting_zoom_max_level, setting_zoom_min_level

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.db import migrations, 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,8 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.files.storage import FileSystemStorage
from django.db import migrations, models
import mayan.apps.documents.models
@@ -18,8 +17,8 @@ class Migration(migrations.Migration):
model_name='document',
name='uuid',
field=models.CharField(
default=mayan.apps.documents.models.UUID_FUNCTION, max_length=48,
editable=False
default=mayan.apps.documents.models.UUID_FUNCTION,
editable=False, max_length=48,
),
preserve_default=True,
),
@@ -27,8 +26,8 @@ class Migration(migrations.Migration):
model_name='documentversion',
name='file',
field=models.FileField(
upload_to=mayan.apps.documents.models.UUID_FUNCTION,
storage=FileSystemStorage(),
upload_to=mayan.apps.documents.models.UUID_FUNCTION,
verbose_name='File'
),
preserve_default=True,

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
@@ -12,8 +11,7 @@ class Migration(migrations.Migration):
operations = [
migrations.RenameField(
model_name='documentpage',
model_name='documentpage', new_name='content_old',
old_name='content',
new_name='content_old',
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
@@ -13,7 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name='documentpage',
name='content_old',
model_name='documentpage', name='content_old',
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
@@ -12,7 +11,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name='documentpage',
name='page_label',
model_name='documentpage', name='page_label',
),
]

File diff suppressed because one or more lines are too long

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='in_trash',
field=models.BooleanField(
default=False, verbose_name='In trash?', editable=False
default=False, editable=False, verbose_name='In trash?'
),
preserve_default=True,
),

View File

@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
@@ -15,8 +15,7 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='DeletedDocument',
fields=[
],
fields=[],
options={
'proxy': True,
},
@@ -26,9 +25,9 @@ class Migration(migrations.Migration):
model_name='document',
name='deleted_date_time',
field=models.DateTimeField(
default=datetime.datetime(
blank=True, default=datetime.datetime(
2015, 7, 4, 0, 54, 7, 910642, tzinfo=utc
), verbose_name='Date and time deleted', blank=True
), verbose_name='Date and time deleted',
),
preserve_default=False,
),

View File

@@ -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):
@@ -23,11 +22,11 @@ class Migration(migrations.Migration):
model_name='documenttype',
name='delete_time_unit',
field=models.CharField(
default='days', max_length=8, verbose_name='Delete time unit',
choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes'), ('seconds', 'Seconds')
]
],
default='days', max_length=8, verbose_name='Delete time unit'
),
preserve_default=True,
),
@@ -35,7 +34,7 @@ class Migration(migrations.Migration):
model_name='documenttype',
name='trash_time_period',
field=models.PositiveIntegerField(
null=True, verbose_name='Trash time period', blank=True
blank=True, null=True, verbose_name='Trash time period'
),
preserve_default=True,
),
@@ -43,20 +42,17 @@ class Migration(migrations.Migration):
model_name='documenttype',
name='trash_time_unit',
field=models.CharField(
blank=True, max_length=8, null=True,
verbose_name='Trash time unit', choices=[
blank=True, choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes'), ('seconds', 'Seconds')
]
], max_length=8, null=True, verbose_name='Trash time unit'
),
preserve_default=True,
),
migrations.AlterField(
model_name='document',
name='deleted_date_time',
field=models.DateTimeField(
verbose_name='Date and time trashed', blank=True
),
), model_name='document', name='deleted_date_time',
preserve_default=True,
),
]

View File

@@ -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):
@@ -12,55 +11,48 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='document',
name='deleted_date_time',
field=models.DateTimeField(
null=True, verbose_name='Date and time trashed', blank=True
blank=True, null=True, verbose_name='Date and time trashed'
),
model_name='document', name='deleted_date_time',
preserve_default=True,
),
migrations.AlterField(
model_name='documenttype',
name='delete_time_period',
field=models.PositiveIntegerField(
default=30, help_text='Amount of time after which documents '
'of this type in the trash will be deleted.',
verbose_name='Delete time period'
),
model_name='documenttype', name='delete_time_period',
preserve_default=True,
),
migrations.AlterField(
model_name='documenttype',
name='delete_time_unit',
field=models.CharField(
default='days', max_length=8, verbose_name='Delete time unit',
choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes')
]
], default='days', max_length=8,
verbose_name='Delete time unit'
),
model_name='documenttype', name='delete_time_unit',
preserve_default=True,
),
migrations.AlterField(
model_name='documenttype',
name='trash_time_period',
field=models.PositiveIntegerField(
help_text='Amount of time after which documents of this type '
'will be moved to the trash.', null=True,
verbose_name='Trash time period', blank=True
),
blank=True, help_text='Amount of time after which documents '
'of this type will be moved to the trash.', null=True,
verbose_name='Trash time period'
), model_name='documenttype', name='trash_time_period',
preserve_default=True,
),
migrations.AlterField(
model_name='documenttype',
name='trash_time_unit',
field=models.CharField(
blank=True, max_length=8, null=True,
verbose_name='Trash time unit', choices=[
blank=True, choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes')
]
], max_length=8, null=True, verbose_name='Trash time unit'
),
preserve_default=True,
model_name='documenttype', name='trash_time_unit',
preserve_default=True
),
]

View File

@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations, models
def make_existing_documents_not_stubs(apps, schema_editor):
def operation_make_existing_documents_not_stubs(apps, schema_editor):
Document = apps.get_model('documents', 'Document')
for document in Document.objects.using(schema_editor.connection.alias).all():
@@ -23,9 +22,9 @@ class Migration(migrations.Migration):
model_name='document',
name='is_stub',
field=models.BooleanField(
default=True, verbose_name='Is stub?', editable=False
default=True, editable=False, verbose_name='Is stub?'
),
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
@@ -20,7 +19,7 @@ class Migration(migrations.Migration):
),
migrations.RenameField(
model_name='documenttype',
old_name='name',
new_name='label',
old_name='name'
),
]

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='documenttype',
name='label',
field=models.CharField(
unique=True, max_length=32, verbose_name='Label'
max_length=32, unique=True, verbose_name='Label'
),
preserve_default=True,
),

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='description',
field=models.TextField(
default='', verbose_name='Description', blank=True
blank=True, default='', verbose_name='Description'
),
preserve_default=False,
),

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='date_added',
field=models.DateTimeField(
auto_now_add=True, verbose_name='Added', db_index=True
auto_now_add=True, db_index=True, verbose_name='Added'
),
preserve_default=True,
),
@@ -23,7 +22,7 @@ class Migration(migrations.Migration):
model_name='documentversion',
name='timestamp',
field=models.DateTimeField(
auto_now_add=True, verbose_name='Timestamp', db_index=True
auto_now_add=True, db_index=True, verbose_name='Timestamp'
),
preserve_default=True,
),

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='description',
field=models.TextField(
default='', verbose_name='Description', blank=True
blank=True, default='', verbose_name='Description'
),
preserve_default=True,
),
@@ -23,9 +22,9 @@ class Migration(migrations.Migration):
model_name='document',
name='label',
field=models.CharField(
default='', max_length=255, blank=True,
help_text='The name of the document', verbose_name='Label',
db_index=True
blank=True, default='', db_index=True,
help_text='The name of the document', max_length=255,
verbose_name='Label'
),
preserve_default=True,
),
@@ -33,7 +32,7 @@ class Migration(migrations.Migration):
model_name='documentversion',
name='comment',
field=models.TextField(
default='', verbose_name='Comment', blank=True
blank=True, default='', verbose_name='Comment'
),
preserve_default=True,
),

File diff suppressed because one or more lines are too long

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='description',
field=models.TextField(
default='', null=True, verbose_name='Description', blank=True
blank=True, default='', null=True, verbose_name='Description'
),
preserve_default=True,
),
@@ -23,9 +22,9 @@ class Migration(migrations.Migration):
model_name='document',
name='label',
field=models.CharField(
default='', max_length=255, blank=True,
help_text='The name of the document', null=True,
verbose_name='Label', db_index=True
blank=True, db_index=True, default='',
help_text='The name of the document', max_length=255,
null=True, verbose_name='Label'
),
preserve_default=True,
),
@@ -33,7 +32,7 @@ class Migration(migrations.Migration):
model_name='document',
name='language',
field=models.CharField(
default='eng', choices=[
blank=True, choices=[
['aar', 'Afar'],
['abk', 'Abkhazian'],
['ace', 'Achinese'],
@@ -539,9 +538,8 @@ class Migration(migrations.Migration):
['zun', 'Zuni'],
['zxx', 'No linguistic content; Not applicable'],
['zza', 'Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki']
], max_length=8, blank=True, null=True,
], default='eng', max_length=8, null=True,
verbose_name='Language'
),
preserve_default=True,
), preserve_default=True,
),
]

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='documentversion',
name='comment',
field=models.TextField(
default='', null=True, verbose_name='Comment', blank=True
blank=True, default='', null=True, verbose_name='Comment'
),
preserve_default=True,
),

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='document',
name='description',
field=models.TextField(
default='', verbose_name='Description', blank=True
blank=True, default='', verbose_name='Description'
),
preserve_default=True,
),

File diff suppressed because one or more lines are too long

View File

@@ -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,7 +14,7 @@ class Migration(migrations.Migration):
model_name='documentversion',
name='comment',
field=models.TextField(
default='', verbose_name='Comment', blank=True
blank=True, default='', verbose_name='Comment'
),
preserve_default=True,
),

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pycountry
from django.db import migrations
import pycountry
def change_bibliographic_to_terminology(apps, schema_editor):
def operation_change_bibliographic_to_terminology(apps, schema_editor):
Document = apps.get_model('documents', 'Document')
for document in Document.objects.using(schema_editor.connection.alias).all():
@@ -31,5 +30,7 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(change_bibliographic_to_terminology),
migrations.RunPython(
code=operation_change_bibliographic_to_terminology
),
]

View File

@@ -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,7 +14,6 @@ class Migration(migrations.Migration):
model_name='document',
name='language',
field=models.CharField(
default='eng', max_length=8, verbose_name='Language',
blank=True, choices=[
['aar', 'Afar'], ['abk', 'Abkhazian'],
['ace', 'Achinese'], ['ach', 'Acoli'],
@@ -325,7 +323,7 @@ class Migration(migrations.Migration):
['zul', 'Zulu'], ['zun', 'Zuni'],
['zxx', 'No linguistic content; Not applicable'],
['zza', 'Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki']
]
], default='eng', max_length=8, verbose_name='Language',
),
preserve_default=True,
),

View File

@@ -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):
@@ -20,22 +19,18 @@ class Migration(migrations.Migration):
},
),
migrations.AlterField(
model_name='document',
name='is_stub',
field=models.BooleanField(
default=True, help_text='A document stub is a document with '
'an entry on the database but no file uploaded. This could '
'be an interrupted upload or a deferred upload via the API.',
verbose_name='Is stub?', editable=False
),
preserve_default=True,
default=True, editable=False, help_text='A document stub is '
'a document with an entry on the database but no file '
'uploaded. This could be an interrupted upload or a '
'deferred upload via the API.',
verbose_name='Is stub?'
), model_name='document', name='is_stub', preserve_default=True
),
migrations.AlterField(
model_name='documenttypefilename',
name='filename',
field=models.CharField(
max_length=128, verbose_name='Label', db_index=True
),
preserve_default=True,
db_index=True, max_length=128, verbose_name='Label'
), model_name='documenttypefilename', name='filename',
preserve_default=True
),
]

View File

@@ -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):
@@ -12,24 +11,21 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='NewVersionBlock',
fields=[
bases=(models.Model,), fields=[
(
'id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
'document', models.ForeignKey(
verbose_name='Document', to='documents.Document'
to='documents.Document', verbose_name='Document'
)
),
],
options={
], name='NewVersionBlock', options={
'verbose_name': 'New version block',
'verbose_name_plural': 'New version blocks',
},
bases=(models.Model,),
),
]

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
@@ -15,19 +14,19 @@ class Migration(migrations.Migration):
model_name='documenttype',
name='delete_time_period',
field=models.PositiveIntegerField(
default=30, help_text='Amount of time after which documents '
'of this type in the trash will be deleted.', null=True,
verbose_name='Delete time period', blank=True
blank=True, default=30, help_text='Amount of time after '
'which documents of this type in the trash will be deleted.',
null=True, verbose_name='Delete time period'
),
),
migrations.AlterField(
model_name='documenttype',
name='delete_time_unit',
field=models.CharField(
default='days', choices=[
blank=True, default='days', choices=[
('days', 'Days'), ('hours', 'Hours'),
('minutes', 'Minutes')
], max_length=8, blank=True, null=True,
], max_length=8, null=True,
verbose_name='Delete time unit'
),
),

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
@@ -6,7 +5,7 @@ import uuid
from django.db import migrations
def convert_uuid_to_hex(apps, schema_editor):
def operation_convert_uuid_to_hex(apps, schema_editor):
Document = apps.get_model('documents', 'Document')
for document in Document.objects.using(schema_editor.connection.alias).all():
@@ -21,5 +20,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(convert_uuid_to_hex),
migrations.RunPython(code=operation_convert_uuid_to_hex),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
@@ -6,14 +5,13 @@ import uuid
from django.db import connection, migrations, models
def forwards(apps, schema_editor):
def operation_forwards(apps, schema_editor):
if not schema_editor.connection.vendor == 'oracle':
# Skip this migration for Oracle
# GitHub issue #251
migrations.AlterField(
model_name='document',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False),
model_name='document', name='uuid',
)
@@ -23,7 +21,7 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(forwards)
migrations.RunPython(code=operation_forwards)
]
def __init__(self, *args, **kwargs):
@@ -32,6 +30,7 @@ class Migration(migrations.Migration):
if connection.vendor == 'postgresql':
self.operations.insert(
0, migrations.RunSQL(
'ALTER TABLE documents_document ALTER COLUMN uuid SET DATA TYPE UUID USING uuid::uuid;'
'ALTER TABLE documents_document ALTER COLUMN uuid SET '
'DATA TYPE UUID USING uuid::uuid;'
)
)

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
@@ -12,13 +11,20 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='document',
name='in_trash',
field=models.BooleanField(default=False, verbose_name='In trash?', db_index=True, editable=False),
field=models.BooleanField(
db_index=True, default=False, editable=False,
verbose_name='In trash?'
),
model_name='document', name='in_trash',
),
migrations.AlterField(
model_name='document',
name='is_stub',
field=models.BooleanField(default=True, editable=False, help_text='A document stub is a document with an entry on the database but no file uploaded. This could be an interrupted upload or a deferred upload via the API.', verbose_name='Is stub?', db_index=True),
field=models.BooleanField(
default=True, db_index=True, editable=False,
help_text='A document stub is a document with an entry on '
'the database but no file uploaded. This could be an '
'interrupted upload or a deferred upload via the API.',
verbose_name='Is stub?'
),
model_name='document', name='is_stub',
),
]

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
@@ -12,31 +11,36 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='DocumentPageCachedImage',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('filename', models.CharField(max_length=128, verbose_name='Filename')),
],
options={
(
'id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID',
)
),
(
'filename', models.CharField(
max_length=128, verbose_name='Filename'
)
),
], name='DocumentPageCachedImage', options={
'verbose_name': 'Document page cached image',
'verbose_name_plural': 'Document page cached images',
},
),
migrations.CreateModel(
name='DocumentPageResult',
fields=[
],
options={
bases=('documents.documentpage',), fields=[],
name='DocumentPageResult', options={
'ordering': ('document_version__document', 'page_number'),
'verbose_name': 'Document page',
'proxy': True,
'proxy': True, 'verbose_name': 'Document page',
'verbose_name_plural': 'Document pages',
},
bases=('documents.documentpage',),
),
migrations.AddField(
model_name='documentpagecachedimage',
name='document_page',
field=models.ForeignKey(related_name='cached_images', verbose_name='Document page', to='documents.DocumentPage'),
field=models.ForeignKey(
related_name='cached_images', to='documents.DocumentPage',
verbose_name='Document page'
),
model_name='documentpagecachedimage', name='document_page',
),
]

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
@@ -13,8 +11,7 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name='newversionblock',
name='document',
model_name='newversionblock', name='document',
),
migrations.DeleteModel(
name='NewVersionBlock',

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-31 06:17
from __future__ import unicode_literals
from django.db import migrations, models
@@ -13,8 +11,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='document',
name='language',
field=models.CharField(blank=True, default='eng', max_length=8, verbose_name='Language'),
field=models.CharField(
blank=True, default='eng', max_length=8,
verbose_name='Language'
), model_name='document', name='language',
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-05 20:08
from __future__ import unicode_literals
from django.db import migrations, models
@@ -13,11 +11,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='documentversion',
name='checksum',
field=models.CharField(
blank=True, db_index=True, editable=False, max_length=64,
null=True, verbose_name='Checksum'
),
), model_name='documentversion', name='checksum',
),
]

View File

@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-06 03:30
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):
@@ -14,7 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='DuplicatedDocument',
fields=[
(
'id', models.AutoField(
@@ -41,8 +38,7 @@ class Migration(migrations.Migration):
verbose_name='Duplicated documents'
)
),
],
options={
], name='DuplicatedDocument', options={
'verbose_name': 'Duplicated document',
'verbose_name_plural': 'Duplicated documents',
},

View File

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

View File

@@ -1,10 +1,9 @@
# -*- 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
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -14,8 +13,7 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='document',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False),
model_name='document', name='uuid',
),
]

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
@@ -16,8 +14,12 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='documentversion',
name='file',
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location=b'mayan/media/document_storage'), upload_to=mayan.apps.documents.models.UUID_FUNCTION, verbose_name='File'),
field=models.FileField(
storage=django.core.files.storage.FileSystemStorage(
location=b'mayan/media/document_storage'
), upload_to=mayan.apps.documents.models.UUID_FUNCTION,
verbose_name='File'
),
model_name='documentversion', name='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
@@ -16,18 +14,26 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='documentversion',
name='encoding',
field=models.CharField(blank=True, editable=False, max_length=64, null=True, verbose_name='Encoding'),
field=models.CharField(
blank=True, editable=False, max_length=64, null=True,
verbose_name='Encoding'
),
model_name='documentversion', name='encoding',
),
migrations.AlterField(
model_name='documentversion',
name='file',
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location=b'/home/rosarior/development/mayan-edms/mayan/media/document_storage'), upload_to=mayan.apps.documents.models.UUID_FUNCTION, verbose_name='File'),
field=models.FileField(
storage=django.core.files.storage.FileSystemStorage(
location=b'/home/rosarior/development/mayan-edms/mayan/media/document_storage'
), upload_to=mayan.apps.documents.models.UUID_FUNCTION,
verbose_name='File'
),
model_name='documentversion', name='file',
),
migrations.AlterField(
model_name='documentversion',
name='mimetype',
field=models.CharField(blank=True, editable=False, max_length=255, null=True, verbose_name='MIME type'),
field=models.CharField(
blank=True, editable=False, max_length=255, null=True,
verbose_name='MIME type'
),
model_name='documentversion', name='mimetype',
),
]

View File

@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-08-23 04:52
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -16,32 +14,41 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='FavoriteDocument',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
('id', models.AutoField(
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
], name='FavoriteDocument', options={
'verbose_name': 'Favorite document',
'verbose_name_plural': 'Favorite documents',
},
),
migrations.AlterModelOptions(
name='document',
options={'ordering': ('label',), 'verbose_name': 'Document', 'verbose_name_plural': 'Documents'},
name='document', options={
'ordering': ('label',), 'verbose_name': 'Document',
'verbose_name_plural': 'Documents'
},
),
migrations.AlterField(
model_name='recentdocument',
name='document',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='recent', to='documents.Document', verbose_name='Document'),
field=models.ForeignKey(
editable=False, on_delete=django.db.models.deletion.CASCADE,
related_name='recent', to='documents.Document',
verbose_name='Document'
), model_name='recentdocument', name='document',
),
migrations.AddField(
model_name='favoritedocument',
name='document',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='favorites', to='documents.Document', verbose_name='Document'),
field=models.ForeignKey(
editable=False, on_delete=django.db.models.deletion.CASCADE,
related_name='favorites', to='documents.Document',
verbose_name='Document'
), model_name='favoritedocument', name='document',
),
migrations.AddField(
model_name='favoritedocument',
name='user',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'),
field=models.ForeignKey(
editable=False, on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL, verbose_name='User'
), model_name='favoritedocument', name='user',
),
]

View File

@@ -1,10 +1,9 @@
# -*- 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
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
@@ -14,68 +13,97 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='document',
name='date_added',
field=models.DateTimeField(auto_now_add=True, db_index=True, help_text='The server date and time when the document was finally processed and added to the system.', verbose_name='Added'),
field=models.DateTimeField(
auto_now_add=True, db_index=True,
help_text='The server date and time when the document was '
'finally processed and added to the system.',
verbose_name='Added'
), model_name='document', name='date_added',
),
migrations.AlterField(
model_name='document',
name='deleted_date_time',
field=models.DateTimeField(blank=True, help_text='The server date and time when the document was moved to the trash.', null=True, verbose_name='Date and time trashed'),
field=models.DateTimeField(
blank=True, help_text='The server date and time when the '
'document was moved to the trash.', null=True,
verbose_name='Date and time trashed'
), model_name='document', name='deleted_date_time',
),
migrations.AlterField(
model_name='document',
name='description',
field=models.TextField(blank=True, default='', help_text='An optional short text describing a document.', verbose_name='Description'),
field=models.TextField(
blank=True, default='', help_text='An optional short text '
'describing a document.', verbose_name='Description'
), model_name='document', name='description',
),
migrations.AlterField(
model_name='document',
name='in_trash',
field=models.BooleanField(db_index=True, default=False, editable=False, help_text='Whether or not this document is in the trash.', verbose_name='In trash?'),
field=models.BooleanField(
db_index=True, default=False, editable=False,
help_text='Whether or not this document is in the trash.',
verbose_name='In trash?'
), model_name='document', name='in_trash',
),
migrations.AlterField(
model_name='document',
name='label',
field=models.CharField(blank=True, db_index=True, default='', help_text='The name of the document.', max_length=255, verbose_name='Label'),
field=models.CharField(
blank=True, db_index=True, default='',
help_text='The name of the document.', max_length=255,
verbose_name='Label'
), model_name='document', name='label',
),
migrations.AlterField(
model_name='document',
name='language',
field=models.CharField(blank=True, default=b'eng', help_text='The dominant language in the document.', max_length=8, verbose_name='Language'),
field=models.CharField(
blank=True, default=b'eng', help_text='The dominant '
'language in the document.', max_length=8,
verbose_name='Language'
), model_name='document', name='language',
),
migrations.AlterField(
model_name='document',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False, help_text='UUID of a document, universally Unique ID. An unique identifiergenerated for each document.', verbose_name='UUID'),
field=models.UUIDField(
default=uuid.uuid4, editable=False, help_text='UUID of a '
'document, universally Unique ID. An unique identifier '
'generated for each document.', verbose_name='UUID'
), model_name='document', name='uuid',
),
migrations.AlterField(
model_name='documenttype',
name='label',
field=models.CharField(help_text='The name of the document type.', max_length=32, unique=True, verbose_name='Label'),
field=models.CharField(
help_text='The name of the document type.', max_length=32,
unique=True, verbose_name='Label'
), model_name='documenttype', name='label',
),
migrations.AlterField(
model_name='documentversion',
name='checksum',
field=models.CharField(blank=True, db_index=True, editable=False, help_text="A hash/checkdigit/fingerprint generated from the document's binary data. Only identical documents will have the same checksum.", max_length=64, null=True, verbose_name='Checksum'),
field=models.CharField(
blank=True, db_index=True, editable=False,
help_text='A hash/checkdigit/fingerprint generated from the '
'document\'s binary data. Only identical documents will have '
'the same checksum.', max_length=64, null=True,
verbose_name='Checksum'
), model_name='documentversion', name='checksum',
),
migrations.AlterField(
model_name='documentversion',
name='comment',
field=models.TextField(blank=True, default='', help_text='An optional short text describing the document version.', verbose_name='Comment'),
field=models.TextField(
blank=True, default='', help_text='An optional short text '
'describing the document version.', verbose_name='Comment'
), model_name='documentversion', name='comment',
),
migrations.AlterField(
model_name='documentversion',
name='encoding',
field=models.CharField(blank=True, editable=False, help_text='The document version file encoding. binary 7-bit, binary 8-bit, text, base64, etc.', max_length=64, null=True, verbose_name='Encoding'),
field=models.CharField(
blank=True, editable=False, help_text='The document version '
'file encoding. binary 7-bit, binary 8-bit, text, base64, '
'etc.', max_length=64, null=True, verbose_name='Encoding'
), model_name='documentversion', name='encoding',
),
migrations.AlterField(
model_name='documentversion',
name='mimetype',
field=models.CharField(blank=True, editable=False, help_text='The document version\'s file mimetype. MIME types are a standard way to describe the format of a file, in this case the file format of the document. Some examples: "text/plain" or "image/jpeg". ', max_length=255, null=True, verbose_name='MIME type'),
field=models.CharField(
blank=True, editable=False, help_text='The document '
'version\'s file mimetype. MIME types are a standard way '
'to describe the format of a file, in this case the file '
'format of the document. Some examples: "text/plain" or '
'"image/jpeg". ', max_length=255, null=True,
verbose_name='MIME type'
), model_name='documentversion', name='mimetype',
),
migrations.AlterField(
model_name='documentversion',
name='timestamp',
field=models.DateTimeField(auto_now_add=True, db_index=True, help_text='The server date and time when the document version was processed.', verbose_name='Timestamp'),
field=models.DateTimeField(
auto_now_add=True, db_index=True, help_text='The server '
'date and time when the document version was processed.',
verbose_name='Timestamp'
), model_name='documentversion', name='timestamp',
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 07:13
from __future__ import unicode_literals
from django.db import migrations, models
@@ -13,8 +11,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='documenttype',
name='label',
field=models.CharField(help_text='The name of the document type.', max_length=96, unique=True, verbose_name='Label'),
field=models.CharField(
help_text='The name of the document type.', max_length=96,
unique=True, verbose_name='Label'
), model_name='documenttype', name='label',
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 07:37
from __future__ import unicode_literals
from django.db import migrations, models
@@ -14,14 +12,15 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='documentpagecachedimage',
name='datetime',
field=models.DateTimeField(auto_now_add=True, db_index=True, default=django.utils.timezone.now, verbose_name='Date time'),
field=models.DateTimeField(
auto_now_add=True, db_index=True,
default=django.utils.timezone.now, verbose_name='Date time'
), model_name='documentpagecachedimage', name='datetime',
preserve_default=False,
),
migrations.AddField(
model_name='documentpagecachedimage',
name='file_size',
field=models.PositiveIntegerField(db_index=True, default=0, verbose_name='File size'),
field=models.PositiveIntegerField(
db_index=True, default=0, verbose_name='File size'
), model_name='documentpagecachedimage', name='file_size',
),
]

View File

@@ -11,21 +11,22 @@ from django.apps import apps
from django.conf import settings
from django.core.files import File
from django.db import models, transaction
from django.template import Template, Context
from django.template import Context, Template
from django.urls import reverse
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.functional import cached_property
from django.utils.timezone import now
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from mayan.apps.acls.models import AccessControlList
from mayan.apps.common.literals import TIME_DELTA_UNIT_CHOICES
from mayan.apps.converter import (
converter_class, BaseTransformation, TransformationResize,
TransformationRotate, TransformationZoom
BaseTransformation, TransformationResize, TransformationRotate,
TransformationZoom, converter_class
)
from mayan.apps.converter.exceptions import InvalidOfficeFormat, PageCountError
from mayan.apps.converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION
from mayan.apps.converter.literals import DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL
from mayan.apps.converter.models import Transformation
from mayan.apps.mimetype.api import get_mimetype
@@ -36,17 +37,18 @@ from .events import (
event_document_version_revert
)
from .literals import (
DEFAULT_DELETE_PERIOD, DEFAULT_DELETE_TIME_UNIT, DOCUMENT_IMAGES_CACHE_NAME
DEFAULT_DELETE_PERIOD, DEFAULT_DELETE_TIME_UNIT,
DOCUMENT_IMAGES_CACHE_NAME
)
from .managers import (
DocumentManager, DocumentPageManager, DocumentVersionManager,
DocumentTypeManager, DuplicatedDocumentManager, FavoriteDocumentManager,
DocumentManager, DocumentPageManager, DocumentTypeManager,
DocumentVersionManager, DuplicatedDocumentManager, FavoriteDocumentManager,
PassthroughManager, RecentDocumentManager, TrashCanManager
)
from .permissions import permission_document_view
from .settings import (
setting_disable_base_image_cache, setting_disable_transformed_image_cache,
setting_display_width, setting_display_height, setting_fix_orientation,
setting_display_height, setting_display_width, setting_fix_orientation,
setting_language, setting_zoom_max_level, setting_zoom_min_level
)
from .signals import (

View File

@@ -8,8 +8,8 @@ from rest_framework.reverse import reverse
from mayan.apps.common.models import SharedUploadedFile
from .models import (
Document, DocumentVersion, DocumentPage, DocumentType,
DocumentTypeFilename, RecentDocument
Document, DocumentPage, DocumentType, DocumentTypeFilename,
DocumentVersion, RecentDocument
)
from .settings import setting_language
from .tasks import task_upload_new_version

View File

@@ -8,7 +8,8 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.smart_settings import Namespace
from .literals import (
DEFAULT_DOCUMENTS_CACHE_MAXIMUM_SIZE, DEFAULT_LANGUAGE, DEFAULT_LANGUAGE_CODES
DEFAULT_DOCUMENTS_CACHE_MAXIMUM_SIZE, DEFAULT_LANGUAGE,
DEFAULT_LANGUAGE_CODES
)
from .utils import callback_update_cache_size

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import override_settings

View File

@@ -7,8 +7,8 @@ from django.conf import settings
from ..models import DocumentType
from .literals import (
TEST_DOCUMENT_TYPE_LABEL, TEST_SMALL_DOCUMENT_FILENAME,
TEST_DOCUMENT_TYPE_QUICK_LABEL
TEST_DOCUMENT_TYPE_LABEL, TEST_DOCUMENT_TYPE_QUICK_LABEL,
TEST_SMALL_DOCUMENT_FILENAME
)
__all__ = ('DocumentTestMixin',)

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
@@ -14,13 +12,13 @@ from mayan.apps.rest_api.tests import BaseAPITestCase
from ..models import Document, DocumentType
from ..permissions import (
permission_document_create, permission_document_download,
permission_document_delete, permission_document_edit,
permission_document_create, permission_document_delete,
permission_document_download, permission_document_edit,
permission_document_new_version, permission_document_properties_edit,
permission_document_restore, permission_document_trash,
permission_document_view, permission_document_type_create,
permission_document_type_delete, permission_document_type_edit,
permission_document_version_revert, permission_document_version_view
permission_document_type_create, permission_document_type_delete,
permission_document_type_edit, permission_document_version_revert,
permission_document_version_view, permission_document_view
)
from .literals import (

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..models import DeletedDocument, Document

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..permissions import permission_document_view

View File

@@ -1,12 +1,10 @@
from __future__ import unicode_literals
from ..literals import (
DEFAULT_DELETE_PERIOD, DEFAULT_DELETE_TIME_UNIT
)
from ..literals import DEFAULT_DELETE_PERIOD, DEFAULT_DELETE_TIME_UNIT
from ..models import DocumentType
from ..permissions import (
permission_document_type_create, permission_document_type_delete,
permission_document_type_edit, permission_document_type_view,
permission_document_type_edit, permission_document_type_view
)
from .base import GenericDocumentViewTestCase

View File

@@ -1,15 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..permissions import (
permission_document_version_revert, permission_document_version_view,
permission_document_version_revert, permission_document_version_view
)
from .base import GenericDocumentViewTestCase
from .literals import (
TEST_SMALL_DOCUMENT_PATH, TEST_VERSION_COMMENT
)
from .literals import TEST_SMALL_DOCUMENT_PATH, TEST_VERSION_COMMENT
class DocumentVersionTestCase(GenericDocumentViewTestCase):

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
@@ -22,7 +20,7 @@ from ..permissions import (
from .base import GenericDocumentViewTestCase
from .literals import (
TEST_DOCUMENT_TYPE_2_LABEL, TEST_SMALL_DOCUMENT_FILENAME,
TEST_TRANSFORMATION_ARGUMENT, TEST_TRANSFORMATION_NAME,
TEST_TRANSFORMATION_ARGUMENT, TEST_TRANSFORMATION_NAME
)
from .mixins import DocumentTypeQuickLabelTestMixin

View File

@@ -1,13 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..permissions import permission_document_view
from .base import GenericDocumentViewTestCase
from .literals import (
TEST_SMALL_DOCUMENT_FILENAME, TEST_SMALL_DOCUMENT_PATH,
)
from .literals import TEST_SMALL_DOCUMENT_FILENAME, TEST_SMALL_DOCUMENT_PATH
class DuplicatedDocumentsViewsTestCase(GenericDocumentViewTestCase):

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from actstream.models import Action
@@ -16,7 +14,6 @@ from ..permissions import (
from .base import GenericDocumentViewTestCase
TEST_DOCUMENT_TYPE_EDITED_LABEL = 'test document type edited label'
TEST_DOCUMENT_TYPE_2_LABEL = 'test document type 2 label'
TEST_TRANSFORMATION_NAME = 'rotate'

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time

View File

@@ -15,8 +15,8 @@ from ..models import (
from .base import GenericDocumentTestCase
from .literals import (
TEST_DOCUMENT_TYPE_LABEL, TEST_DOCUMENT_PATH, TEST_MULTI_PAGE_TIFF_PATH,
TEST_PDF_INDIRECT_ROTATE_PATH, TEST_OFFICE_DOCUMENT_PATH,
TEST_DOCUMENT_PATH, TEST_DOCUMENT_TYPE_LABEL, TEST_MULTI_PAGE_TIFF_PATH,
TEST_OFFICE_DOCUMENT_PATH, TEST_PDF_INDIRECT_ROTATE_PATH,
TEST_SMALL_DOCUMENT_CHECKSUM, TEST_SMALL_DOCUMENT_FILENAME,
TEST_SMALL_DOCUMENT_MIMETYPE, TEST_SMALL_DOCUMENT_PATH,
TEST_SMALL_DOCUMENT_SIZE

View File

@@ -4,7 +4,7 @@ from django.test import override_settings
from mayan.apps.common.tests import BaseTestCase
from mayan.apps.documents.permissions import permission_document_view
from mayan.apps.documents.search import document_search, document_page_search
from mayan.apps.documents.search import document_page_search, document_search
from mayan.apps.documents.tests import DocumentTestMixin

View File

@@ -4,17 +4,16 @@ from django.conf.urls import url
from .api_views import (
APIDeletedDocumentListView, APIDeletedDocumentRestoreView,
APIDeletedDocumentView, APIDocumentDownloadView, APIDocumentView,
APIDocumentListView, APIDocumentVersionDownloadView,
APIDeletedDocumentView, APIDocumentDownloadView, APIDocumentListView,
APIDocumentPageImageView, APIDocumentPageView,
APIDocumentTypeDocumentListView, APIDocumentTypeListView,
APIDocumentTypeView, APIDocumentVersionsListView,
APIDocumentVersionPageListView, APIDocumentVersionView,
APIRecentDocumentListView
APIDocumentTypeView, APIDocumentVersionDownloadView,
APIDocumentVersionPageListView, APIDocumentVersionsListView,
APIDocumentVersionView, APIDocumentView, APIRecentDocumentListView
)
from .views import (
ClearImageCacheView, DeletedDocumentDeleteView,
DeletedDocumentDeleteManyView, DeletedDocumentListView,
ClearImageCacheView, DeletedDocumentDeleteManyView,
DeletedDocumentDeleteView, DeletedDocumentListView,
DocumentDocumentTypeEditView, DocumentDownloadFormView,
DocumentDownloadView, DocumentDuplicatesListView, DocumentEditView,
DocumentListView, DocumentPageListView, DocumentPageNavigationFirst,
@@ -22,13 +21,13 @@ from .views import (
DocumentPageNavigationPrevious, DocumentPageRotateLeftView,
DocumentPageRotateRightView, DocumentPageView, DocumentPageViewResetView,
DocumentPageZoomInView, DocumentPageZoomOutView, DocumentPreviewView,
DocumentPrint, DocumentRestoreView, DocumentRestoreManyView,
DocumentPrint, DocumentRestoreManyView, DocumentRestoreView,
DocumentTransformationsClearView, DocumentTransformationsCloneView,
DocumentTrashView, DocumentTrashManyView, DocumentTypeCreateView,
DocumentTypeDeleteView, DocumentTypeDocumentListView,
DocumentTrashManyView, DocumentTrashView, DocumentTypeCreateView,
DocumentTypeDeleteView, DocumentTypeDocumentListView, DocumentTypeEditView,
DocumentTypeFilenameCreateView, DocumentTypeFilenameDeleteView,
DocumentTypeFilenameEditView, DocumentTypeFilenameListView,
DocumentTypeListView, DocumentTypeEditView, DocumentUpdatePageCountView,
DocumentTypeListView, DocumentUpdatePageCountView,
DocumentVersionDownloadFormView, DocumentVersionDownloadView,
DocumentVersionListView, DocumentVersionRevertView, DocumentVersionView,
DocumentView, DuplicatedDocumentListView, EmptyTrashCanView,
@@ -37,7 +36,6 @@ from .views import (
ScanDuplicatedDocuments
)
urlpatterns = [
url(r'^list/$', DocumentListView.as_view(), name='document_list'),
url(

View File

@@ -20,8 +20,8 @@ from ..forms import DocumentPageForm
from ..models import Document, DocumentPage
from ..permissions import permission_document_view
from ..settings import (
setting_rotation_step, setting_zoom_percent_step, setting_zoom_max_level,
setting_zoom_min_level
setting_rotation_step, setting_zoom_max_level, setting_zoom_min_level,
setting_zoom_percent_step
)
logger = logging.getLogger(__name__)

View File

@@ -14,9 +14,7 @@ from mayan.apps.common.generics import (
)
from ..forms import DocumentTypeFilenameForm_create
from ..icons import (
icon_document_type_filename, icon_document_type_setup
)
from ..icons import icon_document_type_filename, icon_document_type_setup
from ..links import (
link_document_type_create, link_document_type_filename_create
)

View File

@@ -8,7 +8,8 @@ from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse, reverse_lazy
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _, ungettext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from mayan.apps.acls.models import AccessControlList
from mayan.apps.common.compressed_files import ZipArchive
@@ -29,14 +30,14 @@ from ..events import event_document_download, event_document_view
from ..forms import (
DocumentDownloadForm, DocumentForm, DocumentPageNumberForm,
DocumentPreviewForm, DocumentPrintForm, DocumentPropertiesForm,
DocumentTypeSelectForm,
DocumentTypeSelectForm
)
from ..icons import (
icon_document_list, icon_document_list_deleted,
icon_document_list_favorites, icon_document_list_recent_access,
icon_document_list_recent_added, icon_duplicated_document_list
)
from ..literals import PAGE_RANGE_RANGE, DEFAULT_ZIP_FILENAME
from ..literals import DEFAULT_ZIP_FILENAME, PAGE_RANGE_RANGE
from ..models import (
DeletedDocument, Document, DuplicatedDocument, FavoriteDocument,
RecentDocument
@@ -49,7 +50,7 @@ from ..permissions import (
permission_empty_trash
)
from ..settings import (
setting_favorite_count, setting_print_width, setting_print_height,
setting_favorite_count, setting_print_height, setting_print_width,
setting_recent_added_count
)
from ..tasks import task_delete_document, task_update_page_count

View File

@@ -6,8 +6,8 @@ from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from .settings import (
setting_display_width, setting_display_height, setting_preview_width,
setting_preview_height, setting_thumbnail_width, setting_thumbnail_height
setting_display_height, setting_display_width, setting_preview_height,
setting_preview_width, setting_thumbnail_height, setting_thumbnail_width
)

View File

@@ -1,15 +1,17 @@
from __future__ import unicode_literals
from kombu import Exchange, Queue
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from kombu import Exchange, Queue
from mayan.apps.acls import ModelPermission
from mayan.apps.acls.links import link_acl_list
from mayan.apps.acls.permissions import permission_acl_edit, permission_acl_view
from mayan.apps.acls.permissions import (
permission_acl_edit, permission_acl_view
)
from mayan.apps.common import (
MayanAppConfig, menu_list_facet, menu_object, menu_multi_item,
MayanAppConfig, menu_list_facet, menu_multi_item, menu_object,
menu_secondary, menu_setup, menu_tools
)
from mayan.apps.common.widgets import TwoStateWidget
@@ -18,7 +20,7 @@ from mayan.celery import app
from .classes import MailerBackend
from .links import (
link_send_document_link, link_send_document, link_send_multiple_document,
link_send_document, link_send_document_link, link_send_multiple_document,
link_send_multiple_document_link, link_system_mailer_error_log,
link_user_mailer_create, link_user_mailer_delete, link_user_mailer_edit,
link_user_mailer_list, link_user_mailer_log_list, link_user_mailer_setup,
@@ -27,7 +29,7 @@ from .links import (
from .permissions import (
permission_mailing_link, permission_mailing_send_document,
permission_user_mailer_delete, permission_user_mailer_edit,
permission_user_mailer_use, permission_user_mailer_view,
permission_user_mailer_use, permission_user_mailer_view
)
from .queues import * # NOQA

View File

@@ -7,7 +7,9 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.acls.models import AccessControlList
from mayan.apps.common.forms import DynamicModelForm
from mayan.apps.common.settings import setting_project_title, setting_project_url
from mayan.apps.common.settings import (
setting_project_title, setting_project_url
)
from .classes import MailerBackend
from .models import UserMailer

View File

@@ -2,7 +2,6 @@ from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
DEFAULT_DOCUMENT_BODY_TEMPLATE = _(
'Attached to this email is the document: {{ document }}\n\n '
'--------\n '

View File

@@ -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):
@@ -11,12 +10,11 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='LogEntry',
fields=[
bases=(models.Model,), fields=[
(
'id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True
auto_created=True, primary_key=True, serialize=False,
verbose_name='ID'
)
),
(
@@ -26,16 +24,13 @@ class Migration(migrations.Migration):
),
(
'message', models.TextField(
verbose_name='Message', editable=False, blank=True
blank=True, editable=False, verbose_name='Message'
)
),
],
options={
'ordering': ('-datetime',),
'get_latest_by': 'datetime',
], name='LogEntry', options={
'get_latest_by': 'datetime', 'ordering': ('-datetime',),
'verbose_name': 'Log entry',
'verbose_name_plural': 'Log entries',
},
bases=(models.Model,),
),
]

View File

@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-02 08: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):
@@ -14,7 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='UserMailer',
fields=[
(
'id', models.AutoField(
@@ -43,15 +40,13 @@ class Migration(migrations.Migration):
blank=True, verbose_name='Backend data'
)
),
],
options={
], name='UserMailer', options={
'ordering': ('label',),
'verbose_name': 'User mailer',
'verbose_name_plural': 'User mailers',
},
),
migrations.CreateModel(
name='UserMailerLogEntry',
fields=[
(
'id', models.AutoField(
@@ -75,10 +70,8 @@ class Migration(migrations.Migration):
to='mailer.UserMailer', verbose_name='User mailer'
)
),
],
options={
'ordering': ('-datetime',),
'get_latest_by': 'datetime',
], name='UserMailerLogEntry', options={
'get_latest_by': 'datetime', 'ordering': ('-datetime',),
'verbose_name': 'User mailer log entry',
'verbose_name_plural': 'User mailer log entries',
},

View File

@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-03 15:35
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):
@@ -14,17 +12,14 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='usermailer',
name='enabled',
field=models.BooleanField(default=True, verbose_name='Enabled'),
model_name='usermailer', name='enabled',
),
migrations.AlterField(
model_name='usermailerlogentry',
name='user_mailer',
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='error_log', to='mailer.UserMailer',
verbose_name='User mailer'
),
), model_name='usermailerlogentry', name='user_mailer',
),
]

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
@@ -13,8 +11,10 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='usermailer',
name='default',
field=models.BooleanField(default=True, help_text='If default, this mailing profile will be pre-selected on the document mailing form.', verbose_name='Default'),
field=models.BooleanField(
default=True, help_text='If default, this mailing profile '
'will be pre-selected on the document mailing form.',
verbose_name='Default'
), model_name='usermailer', name='default',
),
]

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-18 01:23
from __future__ import unicode_literals
from django.db import migrations, models
@@ -13,8 +11,8 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name='usermailer',
name='label',
field=models.CharField(max_length=128, unique=True, verbose_name='Label'),
field=models.CharField(
max_length=128, unique=True, verbose_name='Label'
), model_name='usermailer', name='label',
),
]

View File

@@ -7,9 +7,9 @@ from mayan.apps.documents.tests.test_models import GenericDocumentTestCase
from .literals import (
TEST_BODY_HTML, TEST_EMAIL_ADDRESS, TEST_EMAIL_FROM_ADDRESS,
TEST_RECIPIENTS_MULTIPLE_COMMA, TEST_RECIPIENTS_MULTIPLE_COMMA_RESULT,
TEST_RECIPIENTS_MULTIPLE_MIXED, TEST_RECIPIENTS_MULTIPLE_MIXED_RESULT,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON_RESULT, TEST_RECIPIENTS_MULTIPLE_MIXED,
TEST_RECIPIENTS_MULTIPLE_MIXED_RESULT,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON_RESULT
)
from .mixins import MailerTestMixin

View File

@@ -12,11 +12,12 @@ from ..permissions import (
)
from .literals import (
TEST_EMAIL_ADDRESS, TEST_EMAIL_FROM_ADDRESS, TEST_USER_MAILER_BACKEND_PATH,
TEST_USER_MAILER_LABEL, TEST_RECIPIENTS_MULTIPLE_COMMA,
TEST_RECIPIENTS_MULTIPLE_COMMA_RESULT, TEST_RECIPIENTS_MULTIPLE_MIXED,
TEST_RECIPIENTS_MULTIPLE_MIXED_RESULT, TEST_RECIPIENTS_MULTIPLE_SEMICOLON,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON_RESULT
TEST_EMAIL_ADDRESS, TEST_EMAIL_FROM_ADDRESS,
TEST_RECIPIENTS_MULTIPLE_COMMA, TEST_RECIPIENTS_MULTIPLE_COMMA_RESULT,
TEST_RECIPIENTS_MULTIPLE_MIXED, TEST_RECIPIENTS_MULTIPLE_MIXED_RESULT,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON,
TEST_RECIPIENTS_MULTIPLE_SEMICOLON_RESULT, TEST_USER_MAILER_BACKEND_PATH,
TEST_USER_MAILER_LABEL
)
from .mailers import TestBackend
from .mixins import MailerTestMixin

View File

@@ -3,10 +3,10 @@ from __future__ import unicode_literals
from django.conf.urls import url
from .views import (
SystemMailerLogEntryListView, MailDocumentLinkView, MailDocumentView,
UserMailerBackendSelectionView, UserMailingCreateView,
UserMailingDeleteView, UserMailingEditView, UserMailerLogEntryListView,
UserMailerTestView, UserMailerListView
MailDocumentLinkView, MailDocumentView, SystemMailerLogEntryListView,
UserMailerBackendSelectionView, UserMailerListView,
UserMailerLogEntryListView, UserMailerTestView, UserMailingCreateView,
UserMailingDeleteView, UserMailingEditView
)
urlpatterns = [

View File

@@ -5,7 +5,8 @@ from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.urls import reverse, reverse_lazy
from django.utils.translation import ungettext, ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from mayan.apps.acls.models import AccessControlList
from mayan.apps.common.generics import (