PEP8 Cleanups
This commit is contained in:
@@ -50,4 +50,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['checkouts']
|
complete_apps = ['checkouts']
|
||||||
|
|||||||
@@ -65,4 +65,3 @@ register_setting(
|
|||||||
default='storage.backends.filebasedstorage.FileBasedStorage',
|
default='storage.backends.filebasedstorage.FileBasedStorage',
|
||||||
description=_(u'A storage backend that all workers can use to share files.'),
|
description=_(u'A storage backend that all workers can use to share files.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -454,7 +454,6 @@ class MultiFormView(FormView):
|
|||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
form_classes = self.get_form_classes()
|
form_classes = self.get_form_classes()
|
||||||
form_name = request.POST.get('action')
|
|
||||||
forms = self.get_forms(form_classes)
|
forms = self.get_forms(form_classes)
|
||||||
|
|
||||||
if all([form.is_valid() for form in forms.values()]):
|
if all([form.is_valid() for form in forms.values()]):
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from mptt.models import MPTTModel
|
|||||||
from documents.models import Document, DocumentType
|
from documents.models import Document, DocumentType
|
||||||
|
|
||||||
from .managers import IndexManager
|
from .managers import IndexManager
|
||||||
from .settings import AVAILABLE_INDEXING_FUNCTIONS
|
|
||||||
|
|
||||||
|
|
||||||
class Index(models.Model):
|
class Index(models.Model):
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.core.files import File
|
|
||||||
|
|
||||||
from mayan.celery import app
|
from mayan.celery import app
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from __future__ import absolute_import
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext
|
|
||||||
|
|
||||||
from acls.api import class_permissions
|
from acls.api import class_permissions
|
||||||
from common.classes import ModelAttribute
|
from common.classes import ModelAttribute
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class DocumentManager(models.Manager):
|
|||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def new_document(self, document_type, file_object, label, command_line=False, description=None, expand=False, language=None, user=None):
|
def new_document(self, document_type, file_object, label, command_line=False, description=None, expand=False, language=None, user=None):
|
||||||
versions_created = []
|
versions_created = []
|
||||||
is_compressed = None
|
|
||||||
|
|
||||||
if expand:
|
if expand:
|
||||||
try:
|
try:
|
||||||
@@ -76,13 +75,10 @@ class DocumentManager(models.Manager):
|
|||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
except NotACompressedFile:
|
except NotACompressedFile:
|
||||||
is_compressed = False
|
|
||||||
logging.debug('Exception: NotACompressedFile')
|
logging.debug('Exception: NotACompressedFile')
|
||||||
if command_line:
|
if command_line:
|
||||||
raise
|
raise
|
||||||
versions_created.append(self.upload_single_document(document_type=document_type, file_object=file_object, description=description, label=label, language=language or LANGUAGE, user=user))
|
versions_created.append(self.upload_single_document(document_type=document_type, file_object=file_object, description=description, label=label, language=language or LANGUAGE, user=user))
|
||||||
else:
|
|
||||||
is_compressed = True
|
|
||||||
else:
|
else:
|
||||||
versions_created.append(self.upload_single_document(document_type=document_type, file_object=file_object, description=description, label=label, language=language or LANGUAGE, user=user))
|
versions_created.append(self.upload_single_document(document_type=document_type, file_object=file_object, description=description, label=label, language=language or LANGUAGE, user=user))
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ class DocumentTypeSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class NewDocumentSerializer(serializers.Serializer):
|
class NewDocumentSerializer(serializers.Serializer):
|
||||||
description = serializers.CharField(required=False)
|
description = serializers.CharField(required=False)
|
||||||
document_type = DocumentTypeSerializer()
|
|
||||||
document_type = serializers.ChoiceField(choices=[(document_type.pk, document_type) for document_type in DocumentType.objects.all()])
|
document_type = serializers.ChoiceField(choices=[(document_type.pk, document_type) for document_type in DocumentType.objects.all()])
|
||||||
expand = serializers.BooleanField(default=False)
|
expand = serializers.BooleanField(default=False)
|
||||||
file = serializers.FileField()
|
file = serializers.FileField()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -20,7 +19,6 @@ class Migration(SchemaMigration):
|
|||||||
# Adding unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro']
|
# Adding unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro']
|
||||||
db.create_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro'])
|
db.create_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Removing unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro']
|
# Removing unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro']
|
||||||
db.delete_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro'])
|
db.delete_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro'])
|
||||||
@@ -38,7 +36,6 @@ class Migration(SchemaMigration):
|
|||||||
# Adding unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro', 'release_level', 'serial']
|
# Adding unique constraint on 'DocumentVersion', fields ['document', 'major', 'minor', 'micro', 'release_level', 'serial']
|
||||||
db.create_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro', 'release_level', 'serial'])
|
db.create_unique(u'documents_documentversion', ['document_id', 'major', 'minor', 'micro', 'release_level', 'serial'])
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -136,4 +133,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['documents']
|
complete_apps = ['documents']
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -13,12 +12,10 @@ class Migration(SchemaMigration):
|
|||||||
self.gf('django.db.models.fields.BooleanField')(default=True),
|
self.gf('django.db.models.fields.BooleanField')(default=True),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting field 'DocumentType.ocr'
|
# Deleting field 'DocumentType.ocr'
|
||||||
db.delete_column(u'documents_documenttype', 'ocr')
|
db.delete_column(u'documents_documenttype', 'ocr')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -117,4 +114,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['documents']
|
complete_apps = ['documents']
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -13,12 +12,10 @@ class Migration(SchemaMigration):
|
|||||||
self.gf('django.db.models.fields.CharField')(default=u'eng', max_length=8),
|
self.gf('django.db.models.fields.CharField')(default=u'eng', max_length=8),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting field 'Document.language'
|
# Deleting field 'Document.language'
|
||||||
db.delete_column(u'documents_document', 'language')
|
db.delete_column(u'documents_document', 'language')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -118,4 +115,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['documents']
|
complete_apps = ['documents']
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -11,14 +10,12 @@ class Migration(SchemaMigration):
|
|||||||
# Deleting field 'DocumentVersion.filename'
|
# Deleting field 'DocumentVersion.filename'
|
||||||
db.delete_column(u'documents_documentversion', 'filename')
|
db.delete_column(u'documents_documentversion', 'filename')
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Adding field 'DocumentVersion.filename'
|
# Adding field 'DocumentVersion.filename'
|
||||||
db.add_column(u'documents_documentversion', 'filename',
|
db.add_column(u'documents_documentversion', 'filename',
|
||||||
self.gf('django.db.models.fields.CharField')(default=u'', max_length=255, db_index=True),
|
self.gf('django.db.models.fields.CharField')(default=u'', max_length=255, db_index=True),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -118,4 +115,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['documents']
|
complete_apps = ['documents']
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class DocumentTestCase(TestCase):
|
|||||||
'version_update': VERSION_UPDATE_MAJOR,
|
'version_update': VERSION_UPDATE_MAJOR,
|
||||||
}
|
}
|
||||||
|
|
||||||
new_version = self.document.new_version(file_object=File(file_object), **new_version_data)
|
self.document.new_version(file_object=File(file_object), **new_version_data)
|
||||||
|
|
||||||
self.failUnlessEqual(self.document.latest_version.get_formated_version(), '2.0.0')
|
self.failUnlessEqual(self.document.latest_version.get_formated_version(), '2.0.0')
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ class DocumentSearchTestCase(TestCase):
|
|||||||
self.document.save()
|
self.document.save()
|
||||||
|
|
||||||
with open(TEST_DOCUMENT_PATH) as file_object:
|
with open(TEST_DOCUMENT_PATH) as file_object:
|
||||||
new_version = self.document.new_version(file_object=File(file_object, name='mayan_11_1.pdf'))
|
self.document.new_version(file_object=File(file_object, name='mayan_11_1.pdf'))
|
||||||
|
|
||||||
# Text extraction on the first page only
|
# Text extraction on the first page only
|
||||||
parse_document_page(self.document.latest_version.pages.all()[0])
|
parse_document_page(self.document.latest_version.pages.all()[0])
|
||||||
@@ -148,7 +148,7 @@ class DocumentUploadFunctionalTestCase(TestCase):
|
|||||||
self.assertTrue(self.admin_user.is_authenticated())
|
self.assertTrue(self.admin_user.is_authenticated())
|
||||||
|
|
||||||
# Create new webform source
|
# Create new webform source
|
||||||
response = self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
||||||
self.assertEqual(WebFormSource.objects.count(), 1)
|
self.assertEqual(WebFormSource.objects.count(), 1)
|
||||||
|
|
||||||
# Upload the test document
|
# Upload the test document
|
||||||
@@ -180,7 +180,7 @@ class DocumentUploadFunctionalTestCase(TestCase):
|
|||||||
self.assertTrue(self.admin_user.is_authenticated())
|
self.assertTrue(self.admin_user.is_authenticated())
|
||||||
|
|
||||||
# Create new webform source
|
# Create new webform source
|
||||||
response = self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
||||||
self.assertEqual(WebFormSource.objects.count(), 1)
|
self.assertEqual(WebFormSource.objects.count(), 1)
|
||||||
|
|
||||||
# Upload the test document
|
# Upload the test document
|
||||||
@@ -295,7 +295,7 @@ class DocumentsViewsFunctionalTestCase(TestCase):
|
|||||||
self.assertTrue(logged_in)
|
self.assertTrue(logged_in)
|
||||||
self.assertTrue(self.admin_user.is_authenticated())
|
self.assertTrue(self.admin_user.is_authenticated())
|
||||||
# Create new webform source
|
# Create new webform source
|
||||||
response = self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
self.client.post(reverse('sources:setup_source_create', args=[SOURCE_CHOICE_WEB_FORM]), {'title': 'test', 'uncompress': 'n', 'enabled': True})
|
||||||
self.assertEqual(WebFormSource.objects.count(), 1)
|
self.assertEqual(WebFormSource.objects.count(), 1)
|
||||||
|
|
||||||
# Upload the test document
|
# Upload the test document
|
||||||
|
|||||||
@@ -290,6 +290,8 @@ def document_document_type_edit(request, document_id=None, document_id_list=None
|
|||||||
context = {
|
context = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'submit_label': _('Submit'),
|
'submit_label': _('Submit'),
|
||||||
|
'previous': previous,
|
||||||
|
'next': next,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(documents) == 1:
|
if len(documents) == 1:
|
||||||
@@ -463,7 +465,8 @@ def document_update_page_count(request, document_id=None, document_id_list=None)
|
|||||||
for document in documents:
|
for document in documents:
|
||||||
task_update_page_count.apply_async(kwargs={'version_id': document.latest_version.pk}, queue='tools')
|
task_update_page_count.apply_async(kwargs={'version_id': document.latest_version.pk}, queue='tools')
|
||||||
|
|
||||||
messages.success(request,
|
messages.success(
|
||||||
|
request,
|
||||||
ungettext(
|
ungettext(
|
||||||
_(u'Document queued for page count reset.'),
|
_(u'Document queued for page count reset.'),
|
||||||
_(u'Documents queued for page count reset.'),
|
_(u'Documents queued for page count reset.'),
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class APIFolderListView(generics.ListCreateAPIView):
|
|||||||
return super(APIFolderListView, self).post(*args, **kwargs)
|
return super(APIFolderListView, self).post(*args, **kwargs)
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
data = request.DATA
|
|
||||||
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
|
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
|
||||||
|
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -17,12 +16,10 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.create_unique(m2m_table_name, ['folder_id', 'document_id'])
|
db.create_unique(m2m_table_name, ['folder_id', 'document_id'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Removing M2M table for field documents on 'Folder'
|
# Removing M2M table for field documents on 'Folder'
|
||||||
db.delete_table(db.shorten_name(u'folders_folder_documents'))
|
db.delete_table(db.shorten_name(u'folders_folder_documents'))
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -89,4 +86,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['folders']
|
complete_apps = ['folders']
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -11,7 +10,6 @@ class Migration(SchemaMigration):
|
|||||||
# Deleting model 'FolderDocument'
|
# Deleting model 'FolderDocument'
|
||||||
db.delete_table(u'folders_folderdocument')
|
db.delete_table(u'folders_folderdocument')
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Adding model 'FolderDocument'
|
# Adding model 'FolderDocument'
|
||||||
db.create_table(u'folders_folderdocument', (
|
db.create_table(u'folders_folderdocument', (
|
||||||
@@ -21,7 +19,6 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.send_create_signal(u'folders', ['FolderDocument'])
|
db.send_create_signal(u'folders', ['FolderDocument'])
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'auth.group': {
|
u'auth.group': {
|
||||||
'Meta': {'object_name': 'Group'},
|
'Meta': {'object_name': 'Group'},
|
||||||
@@ -82,4 +79,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['folders']
|
complete_apps = ['folders']
|
||||||
|
|||||||
@@ -12,14 +12,11 @@ class SmartLinkManager(models.Manager):
|
|||||||
def get_for(self, document, smart_link_obj=None):
|
def get_for(self, document, smart_link_obj=None):
|
||||||
errors = []
|
errors = []
|
||||||
result = {}
|
result = {}
|
||||||
metadata_dict = {}
|
|
||||||
for document_metadata in document.document_metadata.all():
|
|
||||||
metadata_dict[document_metadata.metadata_type.name] = document_metadata.value
|
|
||||||
|
|
||||||
smart_link_qs = self.model.objects.filter(enabled=True)
|
smart_link_qs = self.model.objects.filter(enabled=True)
|
||||||
|
|
||||||
if smart_link_obj:
|
if smart_link_obj:
|
||||||
smart_link_qs= smart_link_qs.filter(pk=smart_link_obj.pk)
|
smart_link_qs = smart_link_qs.filter(pk=smart_link_obj.pk)
|
||||||
|
|
||||||
smart_link_qs = smart_link_qs.filter(document_types=document.document_type)
|
smart_link_qs = smart_link_qs.filter(document_types=document.document_type)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.send_create_signal(u'linking', ['SmartLinkCondition'])
|
db.send_create_signal(u'linking', ['SmartLinkCondition'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting model 'SmartLink'
|
# Deleting model 'SmartLink'
|
||||||
db.delete_table(u'linking_smartlink')
|
db.delete_table(u'linking_smartlink')
|
||||||
@@ -38,7 +37,6 @@ class Migration(SchemaMigration):
|
|||||||
# Deleting model 'SmartLinkCondition'
|
# Deleting model 'SmartLinkCondition'
|
||||||
db.delete_table(u'linking_smartlinkcondition')
|
db.delete_table(u'linking_smartlinkcondition')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'linking.smartlink': {
|
u'linking.smartlink': {
|
||||||
'Meta': {'object_name': 'SmartLink'},
|
'Meta': {'object_name': 'SmartLink'},
|
||||||
@@ -60,4 +58,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['linking']
|
complete_apps = ['linking']
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.create_unique(m2m_table_name, ['smartlink_id', 'documenttype_id'])
|
db.create_unique(m2m_table_name, ['smartlink_id', 'documenttype_id'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Removing M2M table for field document_types on 'SmartLink'
|
# Removing M2M table for field document_types on 'SmartLink'
|
||||||
db.delete_table(db.shorten_name(u'linking_smartlink_document_types'))
|
db.delete_table(db.shorten_name(u'linking_smartlink_document_types'))
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'documents.documenttype': {
|
u'documents.documenttype': {
|
||||||
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
|
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
|
||||||
@@ -51,4 +49,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['linking']
|
complete_apps = ['linking']
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ def smart_link_condition_create(request, smart_link_pk):
|
|||||||
AccessEntry.objects.check_accesses([PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT], request.user, smart_link)
|
AccessEntry.objects.check_accesses([PERMISSION_SMART_LINK_CREATE, PERMISSION_SMART_LINK_EDIT], request.user, smart_link)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = SmartLinkConditionForm(data=request.POST, smart_link=smart_link)
|
form = SmartLinkConditionForm(data=request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
new_smart_link_condition = form.save(commit=False)
|
new_smart_link_condition = form.save(commit=False)
|
||||||
new_smart_link_condition.smart_link = smart_link
|
new_smart_link_condition.smart_link = smart_link
|
||||||
@@ -277,7 +277,7 @@ def smart_link_condition_create(request, smart_link_pk):
|
|||||||
messages.success(request, _(u'Smart link condition: "%s" created successfully.') % new_smart_link_condition)
|
messages.success(request, _(u'Smart link condition: "%s" created successfully.') % new_smart_link_condition)
|
||||||
return HttpResponseRedirect(reverse('linking:smart_link_condition_list', args=[smart_link.pk]))
|
return HttpResponseRedirect(reverse('linking:smart_link_condition_list', args=[smart_link.pk]))
|
||||||
else:
|
else:
|
||||||
form = SmartLinkConditionForm(smart_link=smart_link)
|
form = SmartLinkConditionForm()
|
||||||
|
|
||||||
return render_to_response('main/generic_form.html', {
|
return render_to_response('main/generic_form.html', {
|
||||||
'form': form,
|
'form': form,
|
||||||
@@ -298,13 +298,13 @@ def smart_link_condition_edit(request, smart_link_condition_pk):
|
|||||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', reverse('main:home'))))
|
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', reverse('main:home'))))
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = SmartLinkConditionForm(request.POST, smart_link=smart_link_condition.smart_link, instance=smart_link_condition)
|
form = SmartLinkConditionForm(request.POST, instance=smart_link_condition)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
smart_link_condition = form.save()
|
smart_link_condition = form.save()
|
||||||
messages.success(request, _(u'Smart link condition: "%s" edited successfully.') % smart_link_condition)
|
messages.success(request, _(u'Smart link condition: "%s" edited successfully.') % smart_link_condition)
|
||||||
return HttpResponseRedirect(next)
|
return HttpResponseRedirect(next)
|
||||||
else:
|
else:
|
||||||
form = SmartLinkConditionForm(smart_link=smart_link_condition.smart_link, instance=smart_link_condition)
|
form = SmartLinkConditionForm(instance=smart_link_condition)
|
||||||
|
|
||||||
return render_to_response('main/generic_form.html', {
|
return render_to_response('main/generic_form.html', {
|
||||||
'form': form,
|
'form': form,
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.send_create_signal(u'lock_manager', ['Lock'])
|
db.send_create_signal(u'lock_manager', ['Lock'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting model 'Lock'
|
# Deleting model 'Lock'
|
||||||
db.delete_table(u'lock_manager_lock')
|
db.delete_table(u'lock_manager_lock')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'lock_manager.lock': {
|
u'lock_manager.lock': {
|
||||||
'Meta': {'object_name': 'Lock'},
|
'Meta': {'object_name': 'Lock'},
|
||||||
@@ -33,4 +31,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['lock_manager']
|
complete_apps = ['lock_manager']
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class LockTestCase(TestCase):
|
|||||||
lock_2.release()
|
lock_2.release()
|
||||||
|
|
||||||
def test_timeout_expired(self):
|
def test_timeout_expired(self):
|
||||||
lock_1 = Lock.objects.acquire_lock(name='test_lock_1', timeout=1)
|
Lock.objects.acquire_lock(name='test_lock_1', timeout=1)
|
||||||
|
|
||||||
# lock_1 not release and not expired, should raise LockError
|
# lock_1 not release and not expired, should raise LockError
|
||||||
with self.assertRaises(LockError):
|
with self.assertRaises(LockError):
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from acls.classes import EncapsulatedObject
|
from .models import DocumentTypeMetadataType, MetadataType
|
||||||
|
|
||||||
from .models import DocumentMetadata, DocumentTypeMetadataType, MetadataType
|
|
||||||
|
|
||||||
|
|
||||||
class DocumentTypeMetadataTypeHelper(object):
|
class DocumentTypeMetadataTypeHelper(object):
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ from rest_framework.settings import api_settings
|
|||||||
from acls.models import AccessEntry
|
from acls.models import AccessEntry
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from permissions.models import Permission
|
from permissions.models import Permission
|
||||||
from rest_api.filters import MayanObjectPermissionsFilter
|
|
||||||
from rest_api.permissions import MayanPermission
|
from rest_api.permissions import MayanPermission
|
||||||
|
|
||||||
from .permissions import PERMISSION_OCR_DOCUMENT
|
from .permissions import PERMISSION_OCR_DOCUMENT
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from .models import Document
|
|
||||||
|
|
||||||
|
|
||||||
class DocumentOCRSerializer(serializers.Serializer):
|
class DocumentOCRSerializer(serializers.Serializer):
|
||||||
document_id = serializers.IntegerField()
|
document_id = serializers.IntegerField()
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ class Migration(SchemaMigration):
|
|||||||
# Deleting field 'Source.blacklist'
|
# Deleting field 'Source.blacklist'
|
||||||
db.delete_column(u'sources_source', 'blacklist')
|
db.delete_column(u'sources_source', 'blacklist')
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Adding field 'Source.whitelist'
|
# Adding field 'Source.whitelist'
|
||||||
db.add_column(u'sources_source', 'whitelist',
|
db.add_column(u'sources_source', 'whitelist',
|
||||||
@@ -26,7 +25,6 @@ class Migration(SchemaMigration):
|
|||||||
self.gf('django.db.models.fields.TextField')(default='', blank=True),
|
self.gf('django.db.models.fields.TextField')(default='', blank=True),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'contenttypes.contenttype': {
|
u'contenttypes.contenttype': {
|
||||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
@@ -113,4 +111,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['sources']
|
complete_apps = ['sources']
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
|
||||||
from south.v2 import DataMigration
|
from south.v2 import DataMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -37,7 +36,6 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.send_create_signal(u'sources', ['WatchFolderSource'])
|
db.send_create_signal(u'sources', ['WatchFolderSource'])
|
||||||
|
|
||||||
|
|
||||||
# Changing field 'IntervalBaseModel.document_type'
|
# Changing field 'IntervalBaseModel.document_type'
|
||||||
db.alter_column(u'sources_intervalbasemodel', 'document_type_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'], null=True))
|
db.alter_column(u'sources_intervalbasemodel', 'document_type_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'], null=True))
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from south.utils import datetime_utils as datetime
|
|
||||||
from south.db import db
|
from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -16,12 +15,10 @@ class Migration(SchemaMigration):
|
|||||||
))
|
))
|
||||||
db.send_create_signal(u'sources', ['WatchFolderSource'])
|
db.send_create_signal(u'sources', ['WatchFolderSource'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting model 'WatchFolderSource'
|
# Deleting model 'WatchFolderSource'
|
||||||
db.delete_table(u'sources_watchfoldersource')
|
db.delete_table(u'sources_watchfoldersource')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'contenttypes.contenttype': {
|
u'contenttypes.contenttype': {
|
||||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
@@ -107,4 +104,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['sources']
|
complete_apps = ['sources']
|
||||||
|
|||||||
@@ -11,18 +11,16 @@ class Migration(SchemaMigration):
|
|||||||
# Deleting field 'IntervalBaseModel.document_type'
|
# Deleting field 'IntervalBaseModel.document_type'
|
||||||
db.delete_column(u'sources_intervalbasemodel', 'document_type_id')
|
db.delete_column(u'sources_intervalbasemodel', 'document_type_id')
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|
||||||
# User chose to not deal with backwards NULL issues for 'IntervalBaseModel.document_type'
|
# User chose to not deal with backwards NULL issues for 'IntervalBaseModel.document_type'
|
||||||
raise RuntimeError("Cannot reverse this migration. 'IntervalBaseModel.document_type' and its values cannot be restored.")
|
raise RuntimeError("Cannot reverse this migration. 'IntervalBaseModel.document_type' and its values cannot be restored.")
|
||||||
|
|
||||||
# The following code is provided here to aid in writing a correct migration # Adding field 'IntervalBaseModel.document_type'
|
# The following code is provided here to aid in writing a correct migration # Adding field 'IntervalBaseModel.document_type'
|
||||||
db.add_column(u'sources_intervalbasemodel', 'document_type',
|
db.add_column(u'sources_intervalbasemodel', 'document_type',
|
||||||
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType']),
|
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType']),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'contenttypes.contenttype': {
|
u'contenttypes.contenttype': {
|
||||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
@@ -101,4 +99,4 @@ class Migration(SchemaMigration):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
complete_apps = ['sources']
|
complete_apps = ['sources']
|
||||||
|
|||||||
@@ -13,12 +13,10 @@ class Migration(SchemaMigration):
|
|||||||
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'], null=True),
|
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'], null=True),
|
||||||
keep_default=False)
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
# Deleting field 'IntervalBaseModel.document_type'
|
# Deleting field 'IntervalBaseModel.document_type'
|
||||||
db.delete_column(u'sources_intervalbasemodel', 'document_type_id')
|
db.delete_column(u'sources_intervalbasemodel', 'document_type_id')
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
u'contenttypes.contenttype': {
|
u'contenttypes.contenttype': {
|
||||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class DocumentCreateWizard(MayanPermissionCheckMixin, SessionWizardView):
|
|||||||
'metadata_type': metadata_type,
|
'metadata_type': metadata_type,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return initial
|
return initial
|
||||||
return self.initial_dict.get(step, {})
|
return self.initial_dict.get(step, {})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user