PEP8 cleanup, unused imports, missing imports, style cleanups
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -36,7 +35,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'acls', ['CreatorSingleton'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'AccessEntry'
|
||||
db.delete_table(u'acls_accessentry')
|
||||
@@ -47,7 +45,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'CreatorSingleton'
|
||||
db.delete_table(u'acls_creatorsingleton')
|
||||
|
||||
|
||||
models = {
|
||||
u'acls.accessentry': {
|
||||
'Meta': {'object_name': 'AccessEntry'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -11,14 +10,12 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'CreatorSingleton.lock_id'
|
||||
db.delete_column(u'acls_creatorsingleton', 'lock_id')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding field 'CreatorSingleton.lock_id'
|
||||
db.add_column(u'acls_creatorsingleton', 'lock_id',
|
||||
self.gf('django.db.models.fields.CharField')(default='1', max_length=1, unique=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
u'acls.accessentry': {
|
||||
'Meta': {'object_name': 'AccessEntry'},
|
||||
|
||||
@@ -18,12 +18,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('bootstrap', ['BootstrapSetup'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'BootstrapSetup'
|
||||
db.delete_table('bootstrap_bootstrapsetup')
|
||||
|
||||
|
||||
models = {
|
||||
'bootstrap.bootstrapsetup': {
|
||||
'Meta': {'ordering': "['name']", 'object_name': 'BootstrapSetup'},
|
||||
|
||||
@@ -13,12 +13,10 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 10, 8, 0, 0)),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'BootstrapSetup.created'
|
||||
db.delete_column('bootstrap_bootstrapsetup', 'created')
|
||||
|
||||
|
||||
models = {
|
||||
'bootstrap.bootstrapsetup': {
|
||||
'Meta': {'ordering': "['name']", 'object_name': 'BootstrapSetup'},
|
||||
|
||||
@@ -13,12 +13,10 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.SlugField')(default='', unique=True, max_length=128, blank=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'BootstrapSetup.slug'
|
||||
db.delete_column('bootstrap_bootstrapsetup', 'slug')
|
||||
|
||||
|
||||
models = {
|
||||
'bootstrap.bootstrapsetup': {
|
||||
'Meta': {'ordering': "['name']", 'object_name': 'BootstrapSetup'},
|
||||
|
||||
@@ -17,7 +17,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
# Changing field 'DocumentCheckout.checkout_datetime'
|
||||
db.alter_column('checkouts_documentcheckout', 'checkout_datetime', self.gf('django.db.models.fields.DateTimeField')(null=True))
|
||||
|
||||
@@ -28,7 +27,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'DocumentCheckout.user_object_id'
|
||||
db.delete_column('checkouts_documentcheckout', 'user_object_id')
|
||||
|
||||
|
||||
# Changing field 'DocumentCheckout.checkout_datetime'
|
||||
db.alter_column('checkouts_documentcheckout', 'checkout_datetime', self.gf('django.db.models.fields.DateTimeField')())
|
||||
|
||||
|
||||
@@ -72,15 +72,18 @@ class SplitTimeDeltaField(forms.MultiValueField):
|
||||
errors.update(kwargs['error_messages'])
|
||||
localize = kwargs.get('localize', False)
|
||||
fields = (
|
||||
forms.IntegerField(min_value=0,
|
||||
forms.IntegerField(
|
||||
min_value=0,
|
||||
error_messages={'invalid': errors['invalid_days']},
|
||||
localize=localize
|
||||
),
|
||||
forms.IntegerField(min_value=0,
|
||||
forms.IntegerField(
|
||||
min_value=0,
|
||||
error_messages={'invalid': errors['invalid_hours']},
|
||||
localize=localize
|
||||
),
|
||||
forms.IntegerField(min_value=0,
|
||||
forms.IntegerField(
|
||||
min_value=0,
|
||||
error_messages={'invalid': errors['invalid_minutes']},
|
||||
localize=localize
|
||||
),
|
||||
|
||||
@@ -17,7 +17,7 @@ from navigation.api import register_links, register_top_menu
|
||||
from .conf import settings as common_settings
|
||||
from .conf.settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME,
|
||||
AUTO_ADMIN_PASSWORD, TEMPORARY_DIRECTORY)
|
||||
from .models import AnonymousUserSingleton, AutoAdminSingleton
|
||||
from .models import AutoAdminSingleton
|
||||
from .utils import validate_path
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -14,7 +13,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'AnonymousUserSingleton.lock_id'
|
||||
db.delete_column(u'common_anonymoususersingleton', 'lock_id')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding field 'AutoAdminSingleton.lock_id'
|
||||
db.add_column(u'common_autoadminsingleton', 'lock_id',
|
||||
@@ -26,7 +24,6 @@ class Migration(SchemaMigration):
|
||||
self.gf('django.db.models.fields.CharField')(default=1, max_length=1, unique=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
u'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -3,7 +3,6 @@ from __future__ import absolute_import
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from solo.models import SingletonModel
|
||||
|
||||
@@ -52,7 +52,6 @@ def comment_delete(request, comment_id=None, comment_id_list=None):
|
||||
return HttpResponseRedirect(next)
|
||||
|
||||
context = {
|
||||
#'object_name': _(u'comment'),
|
||||
'delete_view': True,
|
||||
'previous': previous,
|
||||
'next': next,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'Index'
|
||||
db.create_table('document_indexing_index', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -52,9 +51,7 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('document_indexing', ['DocumentRenameCount'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'Index'
|
||||
db.delete_table('document_indexing_index')
|
||||
|
||||
@@ -67,7 +64,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'DocumentRenameCount'
|
||||
db.delete_table('document_indexing_documentrenamecount')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Deleting model 'DocumentRenameCount'
|
||||
db.delete_table('document_indexing_documentrenamecount')
|
||||
|
||||
@@ -20,9 +19,7 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'Index'
|
||||
db.delete_table('document_indexing_index')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Adding model 'DocumentRenameCount'
|
||||
db.create_table('document_indexing_documentrenamecount', (
|
||||
('suffix', self.gf('django.db.models.fields.PositiveIntegerField')(blank=True)),
|
||||
@@ -67,7 +64,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('document_indexing', ['Index'])
|
||||
|
||||
|
||||
models = {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'IndexTemplateNode'
|
||||
db.create_table('document_indexing_indextemplatenode', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -53,9 +52,7 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('document_indexing', ['Index'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'IndexTemplateNode'
|
||||
db.delete_table('document_indexing_indextemplatenode')
|
||||
|
||||
@@ -68,7 +65,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'Index'
|
||||
db.delete_table('document_indexing_index')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'DocumentRenameCount'
|
||||
db.create_table('document_indexing_documentrenamecount', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -17,13 +16,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('document_indexing', ['DocumentRenameCount'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'DocumentRenameCount'
|
||||
db.delete_table('document_indexing_documentrenamecount')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding unique constraint on 'Index', fields ['name']
|
||||
db.create_unique('document_indexing_index', ['name'])
|
||||
|
||||
# Adding unique constraint on 'Index', fields ['title']
|
||||
db.create_unique('document_indexing_index', ['title'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'Index', fields ['title']
|
||||
db.delete_unique('document_indexing_index', ['title'])
|
||||
|
||||
# Removing unique constraint on 'Index', fields ['name']
|
||||
db.delete_unique('document_indexing_index', ['name'])
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -16,12 +15,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.create_unique('document_indexing_index_document_types', ['index_id', 'documenttype_id'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing M2M table for field document_types on 'Index'
|
||||
db.delete_table('document_indexing_index_document_types')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -2,9 +2,9 @@ from __future__ import absolute_import
|
||||
|
||||
from documents.models import Document
|
||||
|
||||
from .models import Index, IndexInstanceNode, DocumentRenameCount
|
||||
from .filesystem import fs_delete_directory_recusive
|
||||
from .api import update_indexes
|
||||
from .filesystem import fs_delete_directory_recusive
|
||||
from .models import Index, IndexInstanceNode, DocumentRenameCount
|
||||
|
||||
|
||||
def do_rebuild_all_indexes():
|
||||
|
||||
@@ -12,28 +12,29 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.models import AccessEntry
|
||||
from acls.utils import apply_default_acls
|
||||
from documents.permissions import PERMISSION_DOCUMENT_VIEW
|
||||
from documents.models import Document
|
||||
from documents.views import document_list
|
||||
from common.utils import encapsulate, generate_choices_w_labels
|
||||
from common.views import assign_remove
|
||||
from common.widgets import two_state_template
|
||||
from documents.permissions import PERMISSION_DOCUMENT_VIEW
|
||||
from documents.models import Document
|
||||
from documents.views import document_list
|
||||
from permissions.models import Permission
|
||||
|
||||
from .forms import IndexForm, IndexTemplateNodeForm
|
||||
from .models import (Index, IndexTemplateNode, IndexInstanceNode)
|
||||
from .tools import do_rebuild_all_indexes
|
||||
from .widgets import (index_instance_item_link, get_breadcrumbs, node_level)
|
||||
from .models import Index, IndexTemplateNode, IndexInstanceNode
|
||||
from .permissions import (PERMISSION_DOCUMENT_INDEXING_VIEW,
|
||||
PERMISSION_DOCUMENT_INDEXING_REBUILD_INDEXES,
|
||||
PERMISSION_DOCUMENT_INDEXING_SETUP,
|
||||
PERMISSION_DOCUMENT_INDEXING_CREATE,
|
||||
PERMISSION_DOCUMENT_INDEXING_EDIT,
|
||||
PERMISSION_DOCUMENT_INDEXING_DELETE
|
||||
)
|
||||
PERMISSION_DOCUMENT_INDEXING_DELETE)
|
||||
from .tools import do_rebuild_all_indexes
|
||||
from .widgets import index_instance_item_link, get_breadcrumbs, node_level
|
||||
|
||||
|
||||
# Setup views
|
||||
|
||||
|
||||
def index_setup_list(request):
|
||||
context = {
|
||||
'title': _(u'indexes'),
|
||||
@@ -55,10 +56,8 @@ def index_setup_list(request):
|
||||
|
||||
context['object_list'] = queryset
|
||||
|
||||
return render_to_response('generic_list.html',
|
||||
context,
|
||||
context_instance=RequestContext(request)
|
||||
)
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def index_setup_create(request):
|
||||
@@ -77,8 +76,7 @@ def index_setup_create(request):
|
||||
return render_to_response('generic_form.html', {
|
||||
'title': _(u'create index'),
|
||||
'form': form,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def index_setup_edit(request, index_pk):
|
||||
@@ -104,8 +102,7 @@ def index_setup_edit(request, index_pk):
|
||||
'index': index,
|
||||
'object_name': _(u'index'),
|
||||
'navigation_object_name': 'index',
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def index_setup_delete(request, index_pk):
|
||||
@@ -125,9 +122,9 @@ def index_setup_delete(request, index_pk):
|
||||
try:
|
||||
index.delete()
|
||||
messages.success(request, _(u'Index: %s deleted successfully.') % index)
|
||||
except Exception, e:
|
||||
except Exception as exception:
|
||||
messages.error(request, _(u'Index: %(index)s delete error: %(error)s') % {
|
||||
'index': index, 'error': e})
|
||||
'index': index, 'error': exception})
|
||||
|
||||
return HttpResponseRedirect(next)
|
||||
|
||||
@@ -224,8 +221,7 @@ def template_node_create(request, parent_pk):
|
||||
'index': parent_node.index,
|
||||
'object_name': _(u'index'),
|
||||
'navigation_object_name': 'index',
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def template_node_edit(request, node_pk):
|
||||
@@ -255,8 +251,7 @@ def template_node_edit(request, node_pk):
|
||||
{'object': 'index', 'name': _(u'index')},
|
||||
{'object': 'node', 'name': _(u'node')}
|
||||
],
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def template_node_delete(request, node_pk):
|
||||
@@ -276,9 +271,9 @@ def template_node_delete(request, node_pk):
|
||||
try:
|
||||
node.delete()
|
||||
messages.success(request, _(u'Node: %s deleted successfully.') % node)
|
||||
except Exception, e:
|
||||
except Exception as exception:
|
||||
messages.error(request, _(u'Node: %(node)s delete error: %(error)s') % {
|
||||
'node': node, 'error': e})
|
||||
'node': node, 'error': exception})
|
||||
|
||||
return HttpResponseRedirect(next)
|
||||
|
||||
@@ -324,10 +319,8 @@ def index_list(request):
|
||||
|
||||
context['object_list'] = queryset
|
||||
|
||||
return render_to_response('generic_list.html',
|
||||
context,
|
||||
context_instance=RequestContext(request)
|
||||
)
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def index_instance_node_view(request, index_instance_node_pk):
|
||||
@@ -402,10 +395,10 @@ def rebuild_index_instances(request):
|
||||
for warning in warnings:
|
||||
messages.warning(request, warning)
|
||||
|
||||
except Exception, e:
|
||||
except Exception as exception:
|
||||
if settings.DEBUG:
|
||||
raise
|
||||
messages.error(request, _(u'Index rebuild error: %s') % e)
|
||||
messages.error(request, _(u'Index rebuild error: %s') % exception)
|
||||
|
||||
return HttpResponseRedirect(next)
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'DocumentVersionSignature'
|
||||
db.create_table('document_signatures_documentversionsignature', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -17,13 +17,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('document_signatures', ['DocumentVersionSignature'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'DocumentVersionSignature'
|
||||
db.delete_table('document_signatures_documentversionsignature')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -4,6 +4,7 @@ from south.db import db
|
||||
from south.v2 import DataMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(DataMigration):
|
||||
|
||||
depends_on = (
|
||||
@@ -20,7 +21,6 @@ class Migration(DataMigration):
|
||||
)
|
||||
document_signature.save()
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
for document_signature in orm.DocumentVersionSignature.objects.all():
|
||||
document_version = document_signature.document_version
|
||||
@@ -28,7 +28,6 @@ class Migration(DataMigration):
|
||||
document_version.signature_file = document_signature.signature_file
|
||||
document_version.save()
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding field 'DocumentVersionSignature.has_embedded_signature'
|
||||
db.add_column('document_signatures_documentversionsignature', 'has_embedded_signature', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersionSignature.has_embedded_signature'
|
||||
db.delete_column('document_signatures_documentversionsignature', 'has_embedded_signature')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import DataMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(DataMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
@@ -20,7 +20,6 @@ class Migration(DataMigration):
|
||||
# No way to revert
|
||||
raise RuntimeError("Cannot reverse this migration.")
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersionSignature.signature_state'
|
||||
db.delete_column('document_signatures_documentversionsignature', 'signature_state')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Adding field 'DocumentVersionSignature.signature_state'
|
||||
db.add_column('document_signatures_documentversionsignature', 'signature_state', self.gf('django.db.models.fields.CharField')(max_length=16, null=True, blank=True), keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -98,7 +98,8 @@ register_diagnostic('documents', _(u'Documents'), document_missing_list)
|
||||
register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))
|
||||
|
||||
register_model_list_columns(Document, [
|
||||
{'name': _(u'thumbnail'), 'attribute':
|
||||
{
|
||||
'name': _(u'thumbnail'), 'attribute':
|
||||
encapsulate(lambda x: document_thumbnail(x, gallery_name='document_list', title=x.filename, size=THUMBNAIL_SIZE))
|
||||
},
|
||||
])
|
||||
|
||||
@@ -4,18 +4,17 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from converter.exceptions import UnkownConvertError, UnknownFileFormat
|
||||
from converter.literals import (DEFAULT_FILE_FORMAT_MIMETYPE, DEFAULT_PAGE_NUMBER,
|
||||
DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL)
|
||||
from converter.literals import (DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION,
|
||||
DEFAULT_ZOOM_LEVEL)
|
||||
from permissions.models import Permission
|
||||
from rest_framework import generics
|
||||
from rest_framework.response import Response
|
||||
|
||||
from acls.models import AccessEntry
|
||||
from rest_api.filters import MayanObjectPermissionsFilter
|
||||
from rest_api.permissions import MayanPermission
|
||||
|
||||
from .conf.settings import (DISPLAY_SIZE, PREVIEW_SIZE, RECENT_COUNT,
|
||||
ROTATION_STEP, ZOOM_PERCENT_STEP, ZOOM_MAX_LEVEL,
|
||||
ZOOM_MIN_LEVEL)
|
||||
from .conf.settings import DISPLAY_SIZE, ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL
|
||||
from .permissions import PERMISSION_DOCUMENT_VIEW
|
||||
from .models import Document, DocumentPage, DocumentVersion
|
||||
from .serializers import (DocumentImageSerializer, DocumentPageSerializer,
|
||||
@@ -113,7 +112,8 @@ class APIDocumentImageView(generics.GenericAPIView):
|
||||
rotation = int(request.GET.get('rotation', DEFAULT_ROTATION)) % 360
|
||||
|
||||
try:
|
||||
return Response({'status': 'success',
|
||||
return Response({
|
||||
'status': 'success',
|
||||
'data': document.get_image(size=size, page=page, zoom=zoom, rotation=rotation, as_base64=True, version=version)
|
||||
})
|
||||
except UnknownFileFormat as exception:
|
||||
|
||||
@@ -7,7 +7,6 @@ class Migration(DataMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
qs = orm.DocumentPage.objects.filter(document_version=None)
|
||||
#print 'Invalid document pages to delete: %s' % qs.count()
|
||||
for document_page in qs:
|
||||
document_page.delete()
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from .cleanup import cleanup
|
||||
|
||||
bootstrap_models = [
|
||||
@@ -14,4 +12,3 @@ bootstrap_models = [
|
||||
}
|
||||
]
|
||||
cleanup_functions = [cleanup]
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
from .models import Document, DocumentVersion, DocumentPage
|
||||
|
||||
@@ -29,4 +28,3 @@ class DocumentSerializer(serializers.HyperlinkedModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Document
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from common.utils import (encapsulate, pretty_size, parse_range, return_diff,
|
||||
urlquote)
|
||||
from common.widgets import two_state_template
|
||||
from common.conf.settings import DEFAULT_PAPER_SIZE
|
||||
from converter.exceptions import UnknownFileFormat, UnkownConvertError
|
||||
from converter.literals import (DEFAULT_FILE_FORMAT_MIMETYPE, DEFAULT_PAGE_NUMBER,
|
||||
DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL)
|
||||
from converter.office_converter import OfficeConverter
|
||||
@@ -34,9 +33,8 @@ from navigation.utils import resolve_to_name
|
||||
from permissions.models import Permission
|
||||
|
||||
from .events import HISTORY_DOCUMENT_EDITED
|
||||
from .conf.settings import (DISPLAY_SIZE, PREVIEW_SIZE, RECENT_COUNT,
|
||||
ROTATION_STEP, ZOOM_PERCENT_STEP, ZOOM_MAX_LEVEL,
|
||||
ZOOM_MIN_LEVEL)
|
||||
from .conf.settings import (PREVIEW_SIZE, RECENT_COUNT, ROTATION_STEP,
|
||||
ZOOM_PERCENT_STEP, ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL)
|
||||
from .forms import (DocumentForm_edit, DocumentPropertiesForm,
|
||||
DocumentPreviewForm, DocumentPageForm,
|
||||
DocumentPageTransformationForm, DocumentContentForm,
|
||||
@@ -53,6 +51,7 @@ from .permissions import (PERMISSION_DOCUMENT_PROPERTIES_EDIT,
|
||||
PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_TYPE_EDIT,
|
||||
PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_CREATE,
|
||||
PERMISSION_DOCUMENT_TYPE_VIEW)
|
||||
from .runtime import storage_backend
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -51,10 +51,8 @@ def folder_list(request, queryset=None, extra_context=None):
|
||||
|
||||
context['object_list'] = queryset
|
||||
|
||||
return render_to_response('generic_list.html',
|
||||
context,
|
||||
context_instance=RequestContext(request)
|
||||
)
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def folder_create(request):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -11,14 +10,12 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'Installation.lock_id'
|
||||
db.delete_column(u'installation_installation', 'lock_id')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding field 'Installation.lock_id'
|
||||
db.add_column(u'installation_installation', 'lock_id',
|
||||
self.gf('django.db.models.fields.CharField')(default=1, max_length=1, unique=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
u'installation.installation': {
|
||||
'Meta': {'object_name': 'Installation'},
|
||||
|
||||
@@ -49,7 +49,6 @@ class SmartLinkImageWidget(forms.widgets.Widget):
|
||||
output.append(get_tags_inline_widget(document))
|
||||
output.append(u'<div style="padding: 5px;">')
|
||||
output.append(document_html_widget(document, click_view='document_display', view='document_preview_multipage', fancybox_class='fancybox-noscaling', gallery_name=u'smart_link_%d_documents_gallery' % value['smart_link_instance'].pk))
|
||||
#output.append(document_html_widget(document, click_view='document_display', view='document_preview_multipage', fancybox_class='fancybox-noscaling', gallery_name=u'smart_link_%d_documents_gallery' % value['smart_link_instance'].pk, image_class='lazy-load-carousel', title=document.filename))
|
||||
output.append(u'</div>')
|
||||
output.append(u'<div class="tc">')
|
||||
output.append(u'<a href="%s"><span class="famfam active famfam-page_go"></span>%s</a>' % (reverse('document_view_simple', args=[document.pk]), ugettext(u'Select')))
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
from django.core.cache import get_cache
|
||||
|
||||
if CACHE_URI:
|
||||
try:
|
||||
cache_backend = get_cache(CACHE_URI)
|
||||
except ImportError:
|
||||
# TODO: display or log error
|
||||
cache_backend = None
|
||||
else:
|
||||
cache_backend = None
|
||||
if cache_backend:
|
||||
acquire_lock = lambda lock_id: cache_backend.add(lock_id, u'true', LOCK_EXPIRE)
|
||||
release_lock = lambda lock_id: cache_backend.delete(lock_id)
|
||||
else:
|
||||
acquire_lock = lambda lock_id: True
|
||||
release_lock = lambda lock_id: True
|
||||
@@ -39,13 +39,11 @@ def maintenance_menu(request):
|
||||
return render_to_response('tools.html', {
|
||||
'blocks': user_tools,
|
||||
'title': _(u'maintenance menu')
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def diagnostics_view(request):
|
||||
return render_to_response('diagnostics.html', {
|
||||
'blocks': diagnostics,
|
||||
'title': _(u'Diagnostics')
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@@ -2,7 +2,6 @@ from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import sh
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import File
|
||||
@@ -9,10 +8,8 @@ from django.utils import unittest
|
||||
|
||||
from documents.models import Document, DocumentType
|
||||
|
||||
from .literals import (QUEUEDOCUMENT_STATE_PROCESSING,
|
||||
DOCUMENTQUEUE_STATE_STOPPED, DOCUMENTQUEUE_STATE_ACTIVE)
|
||||
from .models import DocumentQueue
|
||||
from .api import do_document_ocr
|
||||
from .models import DocumentQueue
|
||||
|
||||
|
||||
class DocumentSearchTestCase(unittest.TestCase):
|
||||
|
||||
@@ -33,6 +33,7 @@ def user_post_save(sender, instance, **kwargs):
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
post_save.connect(user_post_save, sender=User)
|
||||
|
||||
register_setup(role_list)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'Permission'
|
||||
db.create_table('permissions_permission', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -46,9 +45,7 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('permissions', ['RoleMember'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'Permission', fields ['namespace', 'name']
|
||||
db.delete_unique('permissions_permission', ['namespace', 'name'])
|
||||
|
||||
@@ -64,7 +61,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'RoleMember'
|
||||
db.delete_table('permissions_rolemember')
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding model 'StoredPermission'
|
||||
db.create_table('permissions_storedpermission', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -22,9 +21,7 @@ class Migration(SchemaMigration):
|
||||
# Changing field 'PermissionHolder.permission'
|
||||
db.alter_column('permissions_permissionholder', 'permission_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['permissions.StoredPermission']))
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'StoredPermission', fields ['namespace', 'name']
|
||||
db.delete_unique('permissions_storedpermission', ['namespace', 'name'])
|
||||
|
||||
@@ -34,7 +31,6 @@ class Migration(SchemaMigration):
|
||||
# Changing field 'PermissionHolder.permission'
|
||||
db.alter_column('permissions_permissionholder', 'permission_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['permissions.Permission']))
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import DataMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(DataMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
for permission_holder in orm.PermissionHolder.objects.all():
|
||||
permission_holder.delete()
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
raise RuntimeError("Cannot reverse this migration.")
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'Permission', fields ['namespace', 'name']
|
||||
db.delete_unique('permissions_permission', ['namespace', 'name'])
|
||||
|
||||
# Deleting model 'Permission'
|
||||
db.delete_table('permissions_permission')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Adding model 'Permission'
|
||||
db.create_table('permissions_permission', (
|
||||
('namespace', self.gf('django.db.models.fields.CharField')(max_length=64)),
|
||||
@@ -29,7 +26,6 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'Permission', fields ['namespace', 'name']
|
||||
db.create_unique('permissions_permission', ['namespace', 'name'])
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -6,7 +6,7 @@ import operator
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse, reverse_lazy
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.http import HttpResponseRedirect, Http404
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -17,12 +16,10 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('registration', ['RegistrationSingleton'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'RegistrationSingleton'
|
||||
db.delete_table('registration_registrationsingleton')
|
||||
|
||||
|
||||
models = {
|
||||
'registration.registrationsingleton': {
|
||||
'Meta': {'object_name': 'RegistrationSingleton'},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.utils import datetime_utils as datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -11,14 +10,12 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'RegistrationSingleton.lock_id'
|
||||
db.delete_column(u'registration_registrationsingleton', 'lock_id')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding field 'RegistrationSingleton.lock_id'
|
||||
db.add_column(u'registration_registrationsingleton', 'lock_id',
|
||||
self.gf('django.db.models.fields.CharField')(default=1, max_length=1, unique=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
u'registration.registrationsingleton': {
|
||||
'Meta': {'object_name': 'RegistrationSingleton'},
|
||||
|
||||
@@ -19,4 +19,3 @@ class MayanObjectPermissionsFilter(BaseFilterBackend):
|
||||
return queryset
|
||||
else:
|
||||
return queryset
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.auth.models import Group, User
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
|
||||
class APISerializer(serializers.Serializer):
|
||||
@@ -18,4 +15,3 @@ class APIAppSerializer(serializers.Serializer):
|
||||
|
||||
class APIVersionSerializer(serializers.Serializer):
|
||||
apps = APIAppSerializer()
|
||||
|
||||
|
||||
@@ -3,10 +3,7 @@ from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from rest_framework import generics
|
||||
from rest_framework.generics import RetrieveAPIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from project_setup.api import register_setup
|
||||
|
||||
from .links import check_settings
|
||||
|
||||
|
||||
def is_superuser(context):
|
||||
return context['request'].user.is_staff or context['request'].user.is_superuser
|
||||
|
||||
|
||||
check_settings = {'text': _(u'settings'), 'view': 'setting_list', 'famfam': 'cog', 'icon': 'cog.png', 'condition': is_superuser, 'children_view_regex': [r'^setting_']}
|
||||
|
||||
register_setup(check_settings)
|
||||
|
||||
@@ -32,7 +32,8 @@ def setting_list(request):
|
||||
'extra_columns': [
|
||||
{'name': _(u'name'), 'attribute': encapsulate(lambda x: mark_safe(u'<span style="font-weight: bold;">%s</span><br />%s' % (x.get('global_name'), x.get('description'))))},
|
||||
{'name': _(u'default'), 'attribute': encapsulate(lambda x: return_type(x['default']))},
|
||||
{'name': _(u'value'), 'attribute': encapsulate(lambda x: mark_safe(u'<div class="nowrap">%s %s</div>' % (
|
||||
{
|
||||
'name': _(u'value'), 'attribute': encapsulate(lambda x: mark_safe(u'<div class="nowrap">%s %s</div>' % (
|
||||
return_type(getattr(x['module'], x['name'])),
|
||||
exists_with_famfam(getattr(x['module'], x['name'])) if x['exists'] else ''
|
||||
)))
|
||||
|
||||
@@ -46,7 +46,8 @@ register_links(['setup_source_transformation_create', 'setup_source_transformati
|
||||
source_views = ['setup_web_form_list', 'setup_staging_folder_list', 'setup_watch_folder_list', 'setup_source_edit', 'setup_source_delete', 'setup_source_create', 'setup_source_transformation_list', 'setup_source_transformation_edit', 'setup_source_transformation_delete', 'setup_source_transformation_create']
|
||||
|
||||
register_model_list_columns(StagingFile, [
|
||||
{'name': _(u'thumbnail'), 'attribute':
|
||||
{
|
||||
'name': _(u'thumbnail'), 'attribute':
|
||||
encapsulate(lambda x: staging_file_thumbnail(x, gallery_name='staging_list', title=x.filename, size='100'))
|
||||
},
|
||||
])
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from converter.exceptions import UnkownConvertError, UnknownFileFormat
|
||||
from converter.literals import (DEFAULT_FILE_FORMAT_MIMETYPE, DEFAULT_PAGE_NUMBER,
|
||||
from converter.literals import (DEFAULT_PAGE_NUMBER,
|
||||
DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL)
|
||||
from permissions.models import Permission
|
||||
from rest_framework import generics
|
||||
from rest_framework.response import Response
|
||||
|
||||
from documents.conf.settings import (DISPLAY_SIZE, PREVIEW_SIZE, RECENT_COUNT,
|
||||
ROTATION_STEP, ZOOM_PERCENT_STEP, ZOOM_MAX_LEVEL,
|
||||
from documents.conf.settings import (DISPLAY_SIZE, ZOOM_MAX_LEVEL,
|
||||
ZOOM_MIN_LEVEL)
|
||||
from rest_api.filters import MayanObjectPermissionsFilter
|
||||
from rest_api.permissions import MayanPermission
|
||||
|
||||
from .models import StagingFolder
|
||||
from .serializers import (StagingFolderFileSerializer, StagingFolderSerializer,
|
||||
@@ -81,7 +76,8 @@ class APIStagingSourceFileImageView(generics.GenericAPIView):
|
||||
rotation = int(request.GET.get('rotation', DEFAULT_ROTATION)) % 360
|
||||
|
||||
try:
|
||||
return Response({'status': 'success',
|
||||
return Response({
|
||||
'status': 'success',
|
||||
'data': staging_file.get_image(size=size, page=page, zoom=zoom, rotation=rotation, as_base64=True)
|
||||
})
|
||||
except UnknownFileFormat as exception:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -72,7 +71,6 @@ class Migration(SchemaMigration):
|
||||
db.send_create_signal('sources', ['OutOfProcess'])
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'StagingFolder'
|
||||
db.delete_table('sources_stagingfolder')
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from .cleanup import cleanup
|
||||
|
||||
cleanup_functions = [cleanup]
|
||||
|
||||
@@ -12,15 +12,8 @@ from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from rest_framework import generics
|
||||
from rest_framework.response import Response
|
||||
|
||||
from acls.models import AccessEntry
|
||||
from common.utils import encapsulate
|
||||
from converter.exceptions import UnkownConvertError, UnknownFileFormat
|
||||
from converter.literals import (DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION,
|
||||
DEFAULT_ZOOM_LEVEL)
|
||||
from documents.conf.settings import DISPLAY_SIZE, ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL
|
||||
from documents.exceptions import NewDocumentVersionNotAllowed
|
||||
from documents.models import DocumentType, Document
|
||||
from documents.permissions import (PERMISSION_DOCUMENT_CREATE,
|
||||
@@ -38,8 +31,6 @@ from .models import (WebForm, StagingFolder, SourceTransformation,
|
||||
from .permissions import (PERMISSION_SOURCES_SETUP_VIEW,
|
||||
PERMISSION_SOURCES_SETUP_EDIT, PERMISSION_SOURCES_SETUP_DELETE,
|
||||
PERMISSION_SOURCES_SETUP_CREATE)
|
||||
from .serializers import (StagingFolderSerializer, StagingFolderFileSerializer,
|
||||
StagingSourceFileImageSerializer)
|
||||
|
||||
|
||||
def document_create_siblings(request, document_id):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from navigation.api import register_links, register_model_list_columns
|
||||
from navigation.api import register_links
|
||||
|
||||
from .classes import Statistic, StatisticNamespace
|
||||
from .links import link_execute, link_namespace_details, link_namespace_list
|
||||
|
||||
@@ -33,7 +33,8 @@ register_model_list_columns(Tag, [
|
||||
])
|
||||
|
||||
register_model_list_columns(Document, [
|
||||
{'name': _(u'tags'), 'attribute':
|
||||
{
|
||||
'name': _(u'tags'), 'attribute':
|
||||
encapsulate(lambda x: get_tags_inline_widget_simple(x))
|
||||
},
|
||||
])
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
|
||||
from permissions.models import Permission
|
||||
from rest_framework import generics
|
||||
from rest_framework.response import Response
|
||||
|
||||
from rest_api.filters import MayanObjectPermissionsFilter
|
||||
from rest_api.permissions import MayanPermission
|
||||
|
||||
@@ -10,7 +10,6 @@ from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from rest_framework import generics
|
||||
from taggit.models import Tag
|
||||
|
||||
from acls.models import AccessEntry
|
||||
@@ -20,15 +19,12 @@ from documents.models import Document
|
||||
from documents.views import document_list
|
||||
from documents.permissions import PERMISSION_DOCUMENT_VIEW
|
||||
from permissions.models import Permission
|
||||
from rest_api.filters import MayanObjectPermissionsFilter
|
||||
from rest_api.permissions import MayanPermission
|
||||
|
||||
from .forms import TagListForm, TagForm
|
||||
from .models import TagProperties
|
||||
from .permissions import (PERMISSION_TAG_CREATE, PERMISSION_TAG_ATTACH,
|
||||
PERMISSION_TAG_REMOVE, PERMISSION_TAG_DELETE, PERMISSION_TAG_EDIT,
|
||||
PERMISSION_TAG_VIEW)
|
||||
from .serializers import TagSerializer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -60,8 +56,7 @@ def tag_create(request):
|
||||
return render_to_response('generic_form.html', {
|
||||
'title': _(u'create tag'),
|
||||
'form': form,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def tag_attach(request, document_id=None, document_id_list=None):
|
||||
@@ -143,10 +138,8 @@ def tag_list(request, queryset=None, extra_context=None):
|
||||
|
||||
context['object_list'] = queryset
|
||||
|
||||
return render_to_response('generic_list.html',
|
||||
context,
|
||||
context_instance=RequestContext(request)
|
||||
)
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def tag_delete(request, tag_id=None, tag_id_list=None):
|
||||
@@ -235,8 +228,7 @@ def tag_edit(request, tag_id):
|
||||
'form': form,
|
||||
'object': tag,
|
||||
'object_name': _(u'tag'),
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def tag_tagged_item_list(request, tag_id):
|
||||
|
||||
@@ -2,5 +2,4 @@ from __future__ import absolute_import
|
||||
|
||||
from .cleanup import cleanup
|
||||
|
||||
|
||||
cleanup_functions = [cleanup]
|
||||
|
||||
@@ -8,6 +8,7 @@ from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.utils import generate_choices_w_labels, encapsulate
|
||||
from common.views import assign_remove
|
||||
from common.widgets import two_state_template
|
||||
@@ -73,8 +74,7 @@ def user_edit(request, user_id):
|
||||
'form': form,
|
||||
'object': user,
|
||||
'object_name': _(u'user'),
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def user_add(request):
|
||||
@@ -94,8 +94,7 @@ def user_add(request):
|
||||
return render_to_response('generic_form.html', {
|
||||
'title': _(u'create new user'),
|
||||
'form': form,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def user_delete(request, user_id=None, user_id_list=None):
|
||||
@@ -215,7 +214,6 @@ def user_multiple_set_password(request):
|
||||
|
||||
|
||||
def get_user_groups(user):
|
||||
#return user.group_set.all()
|
||||
return Group.objects.filter(user=user)
|
||||
|
||||
|
||||
@@ -303,8 +301,7 @@ def group_add(request):
|
||||
return render_to_response('generic_form.html', {
|
||||
'title': _(u'create new group'),
|
||||
'form': form,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def group_delete(request, group_id=None, group_id_list=None):
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from web_theme.conf import settings as web_theme_settings
|
||||
from ..conf import settings as web_theme_settings
|
||||
|
||||
register = Library()
|
||||
|
||||
@@ -27,15 +29,11 @@ def get_theme(parser, token):
|
||||
except ValueError:
|
||||
raise TemplateSyntaxError('%r tag requires arguments' % token.contents.split()[0])
|
||||
|
||||
#m = re.search(r'(.*?) as (\w+)', arg)
|
||||
m = re.search(r'as (\w+)', arg)
|
||||
if not m:
|
||||
raise TemplateSyntaxError('%r tag had invalid arguments' % tag_name)
|
||||
#format_string, var_name = m.groups()
|
||||
var_name = m.groups()
|
||||
|
||||
#if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")):
|
||||
# raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
|
||||
return GetThemeNode(var_name)
|
||||
|
||||
|
||||
@@ -79,5 +77,4 @@ def get_web_theme_setting(parser, token):
|
||||
|
||||
@register.filter
|
||||
def highlight(text, word):
|
||||
#return mark_safe(unicode(text).replace(word, mark_safe('<span class="highlight">%s</span>' % word)))
|
||||
return mark_safe(unicode(text).replace(word, mark_safe('<mark>%s</mark>' % word)))
|
||||
|
||||
@@ -8,4 +8,3 @@ if __name__ == "__main__":
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user