PEP8 cleanups, unused imports cleanups
This commit is contained in:
@@ -12,8 +12,7 @@ from django.utils.html import escape
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .utils import return_attrib
|
||||
from .widgets import (DetailSelectMultiple, PlainWidget, TextAreaDiv,
|
||||
EmailInput)
|
||||
from .widgets import DetailSelectMultiple, PlainWidget, EmailInput
|
||||
|
||||
|
||||
class DetailForm(forms.ModelForm):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from django.template import Library
|
||||
from django.utils.importlib import import_module
|
||||
|
||||
from common.models import AutoAdminSingleton
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ from navigation.api import register_links
|
||||
from project_setup.api import register_setup
|
||||
|
||||
from .api import Key
|
||||
from .links import (private_keys, public_keys, key_delete, key_query,
|
||||
key_receive, key_setup)
|
||||
from .links import (public_keys, key_delete, key_query, key_receive,
|
||||
key_setup)
|
||||
|
||||
# register_links(['key_delete', 'key_private_list', 'key_public_list', 'key_query'], [private_keys, public_keys, key_query], menu_name='sidebar')
|
||||
register_links(['key_delete', 'key_public_list', 'key_query'], [public_keys, key_query], menu_name='sidebar')
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from documents.models import Document
|
||||
from acls.views import acl_list_for
|
||||
from documents.models import Document
|
||||
|
||||
|
||||
def document_acl_list(request, document_id):
|
||||
|
||||
@@ -2,13 +2,12 @@ from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from django.utils import unittest
|
||||
from django.conf import settings
|
||||
from django.core.files.base import File
|
||||
from django.utils import unittest
|
||||
|
||||
from django_gpg.api import SIGNATURE_STATE_VALID
|
||||
from documents.models import Document, DocumentType
|
||||
from documents.literals import VERSION_UPDATE_MAJOR, RELEASE_LEVEL_FINAL
|
||||
from documents.models import Document, DocumentType
|
||||
|
||||
from .models import DocumentVersionSignature
|
||||
|
||||
|
||||
@@ -92,7 +92,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))
|
||||
},
|
||||
])
|
||||
|
||||
@@ -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 'DocumentType'
|
||||
db.create_table('documents_documenttype', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -70,9 +69,7 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('documents', ['RecentDocument'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'DocumentType'
|
||||
db.delete_table('documents_documenttype')
|
||||
|
||||
@@ -91,7 +88,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'RecentDocument'
|
||||
db.delete_table('documents_recentdocument')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# encoding: utf-8
|
||||
import os
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import DataMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(DataMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
@@ -18,7 +18,7 @@ class Migration(DataMigration):
|
||||
for document in orm.Document.objects.all():
|
||||
document.file_filename, document.file_extension = document.file_filename.split(os.extsep)
|
||||
document.save()
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -4,20 +4,17 @@ from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Deleting field 'Document.file_extension'
|
||||
db.delete_column('documents_document', 'file_extension')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Adding field 'Document.file_extension'
|
||||
db.add_column('documents_document', 'file_extension', self.gf('django.db.models.fields.CharField')(default=u'', max_length=16, db_index=True), keep_default=False)
|
||||
|
||||
|
||||
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 'DocumentVersion'
|
||||
db.create_table('documents_documentversion', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -32,9 +31,7 @@ class Migration(SchemaMigration):
|
||||
# Adding field 'DocumentPage.document_version'
|
||||
db.add_column('documents_documentpage', 'document_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True, blank=True), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'DocumentVersion', fields ['document', 'mayor', 'minor', 'micro', 'release_level', 'serial']
|
||||
db.delete_unique('documents_documentversion', ['document_id', 'mayor', 'minor', 'micro', 'release_level', 'serial'])
|
||||
|
||||
@@ -44,7 +41,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting field 'DocumentPage.document_version'
|
||||
db.delete_column('documents_documentpage', 'document_version_id')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
# 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 document in orm.Document.objects.all():
|
||||
document_version = document.versions.create(
|
||||
document = document,
|
||||
timestamp = document.date_added,
|
||||
file = document.file,
|
||||
mimetype = document.file_mimetype,
|
||||
encoding = document.file_mime_encoding,
|
||||
filename = document.file_filename,
|
||||
checksum = document.checksum,
|
||||
document=document,
|
||||
timestamp=document.date_added,
|
||||
file=document.file,
|
||||
mimetype=document.file_mimetype,
|
||||
encoding=document.file_mime_encoding,
|
||||
filename=document.file_filename,
|
||||
checksum=document.checksum,
|
||||
)
|
||||
document_version.save()
|
||||
for document_page in document.pages.all():
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# 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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
# Changing field 'DocumentVersion.document'
|
||||
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document']))
|
||||
|
||||
@@ -35,9 +35,7 @@ class Migration(SchemaMigration):
|
||||
# Changing field 'DocumentPage.document_version'
|
||||
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion']))
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'DocumentVersion.document'
|
||||
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'], null=True))
|
||||
|
||||
@@ -65,7 +63,6 @@ class Migration(SchemaMigration):
|
||||
# Changing field 'DocumentPage.document_version'
|
||||
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True))
|
||||
|
||||
|
||||
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):
|
||||
|
||||
# Removing unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
|
||||
db.delete_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
|
||||
|
||||
@@ -20,9 +19,7 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
|
||||
db.create_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Removing unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
|
||||
db.delete_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
|
||||
|
||||
@@ -35,7 +32,6 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
|
||||
db.create_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -4,20 +4,17 @@ from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding field 'DocumentVersion.comment'
|
||||
db.add_column('documents_documentversion', 'comment', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersion.comment'
|
||||
db.delete_column('documents_documentversion', 'comment')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -4,20 +4,17 @@ from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Changing field 'Document.date_added'
|
||||
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')())
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'Document.date_added'
|
||||
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True))
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -4,20 +4,17 @@ from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding field 'DocumentVersion.signature_state'
|
||||
db.add_column('documents_documentversion', 'signature_state', self.gf('django.db.models.fields.CharField')(max_length=16, null=True, blank=True), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersion.signature_state'
|
||||
db.delete_column('documents_documentversion', 'signature_state')
|
||||
|
||||
|
||||
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 'DocumentVersion.signature_file'
|
||||
db.add_column('documents_documentversion', 'signature_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersion.signature_file'
|
||||
db.delete_column('documents_documentversion', 'signature_file')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
|
||||
@@ -1,33 +1,29 @@
|
||||
# encoding: utf-8
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
|
||||
depends_on = (
|
||||
('document_signatures', '0002_move_signatures_to_new_app'),
|
||||
)
|
||||
)
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Deleting field 'DocumentVersion.signature_file'
|
||||
db.delete_column('documents_documentversion', 'signature_file')
|
||||
|
||||
# Deleting field 'DocumentVersion.signature_state'
|
||||
db.delete_column('documents_documentversion', 'signature_state')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Adding field 'DocumentVersion.signature_file'
|
||||
db.add_column('documents_documentversion', 'signature_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True), keep_default=False)
|
||||
|
||||
# Adding field 'DocumentVersion.signature_state'
|
||||
db.add_column('documents_documentversion', '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'},
|
||||
|
||||
@@ -8,7 +8,6 @@ from django.db import models
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Changing field 'DocumentVersion.mimetype'
|
||||
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
|
||||
|
||||
@@ -16,7 +15,6 @@ class Migration(SchemaMigration):
|
||||
db.alter_column('documents_documentversion', 'encoding', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'DocumentVersion.mimetype'
|
||||
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64))
|
||||
|
||||
@@ -157,4 +155,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['documents']
|
||||
complete_apps = ['documents']
|
||||
|
||||
@@ -11,12 +11,10 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'DocumentType', fields ['name']
|
||||
db.create_unique('documents_documenttype', ['name'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing unique constraint on 'DocumentType', fields ['name']
|
||||
db.delete_unique('documents_documenttype', ['name'])
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
@@ -151,4 +149,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['documents']
|
||||
complete_apps = ['documents']
|
||||
|
||||
@@ -8,12 +8,10 @@ from django.db import models
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Changing field 'DocumentVersion.mimetype'
|
||||
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'DocumentVersion.mimetype'
|
||||
db.alter_column('documents_documentversion', 'mimetype', self.gf('django.db.models.fields.CharField')(max_length=64, null=True))
|
||||
|
||||
@@ -151,4 +149,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['documents']
|
||||
complete_apps = ['documents']
|
||||
|
||||
@@ -2,8 +2,6 @@ from django.template import Library, Node, Variable
|
||||
|
||||
from converter.api import get_dimensions
|
||||
|
||||
from documents.conf.settings import PRINT_SIZE
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation.api import register_sidebar_template, register_links
|
||||
|
||||
from .links import search, search_advanced, search_again
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import re
|
||||
import types
|
||||
import logging
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
|
||||
from django.db.models import Q
|
||||
from django.db.models.loading import get_model
|
||||
@@ -37,7 +36,7 @@ class SearchModel(object):
|
||||
|
||||
def get_all_search_fields(self):
|
||||
return self.search_fields.values()
|
||||
|
||||
|
||||
def get_search_field(self, full_name):
|
||||
return self.search_fields[full_name]
|
||||
|
||||
@@ -57,7 +56,7 @@ class SearchModel(object):
|
||||
"""
|
||||
search_field = SearchField(self, *args, **kwargs)
|
||||
self.search_fields[search_field.get_full_name()] = search_field
|
||||
|
||||
|
||||
def add_related_field(self, *args, **kwargs):
|
||||
"""
|
||||
Add a search field that will search content in a related field in
|
||||
@@ -92,15 +91,15 @@ class SearchModel(object):
|
||||
'field_name': [search_field.field],
|
||||
'terms': self.normalize_query(query_string)
|
||||
}
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
logger.debug('search_dict: %s' % search_dict)
|
||||
|
||||
return self.execute_search(search_dict, global_and_search=False)
|
||||
|
||||
def advanced_search(self, dictionary):
|
||||
search_dict = {}
|
||||
|
||||
|
||||
for key, value in dictionary.items():
|
||||
logger.debug('key: %s' % key)
|
||||
logger.debug('value: %s' % value)
|
||||
@@ -118,7 +117,7 @@ class SearchModel(object):
|
||||
'field_name': [search_field.field],
|
||||
'terms': self.normalize_query(value)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logger.debug('search_dict: %s' % search_dict)
|
||||
@@ -147,12 +146,12 @@ class SearchModel(object):
|
||||
|
||||
# Initialize per field result set
|
||||
field_result_set = set()
|
||||
|
||||
|
||||
# Get results per search field
|
||||
for query in field_query_list:
|
||||
logger.debug('query: %s' % query)
|
||||
term_query_result_set = set(model.objects.filter(query).values_list(data['return_value'], flat=True))
|
||||
|
||||
|
||||
# Convert the QuerySet to a Python set and perform the
|
||||
# AND operation on the program and not as a query.
|
||||
# This operation ANDs all the field term results
|
||||
@@ -174,7 +173,7 @@ class SearchModel(object):
|
||||
model_result_set &= field_result_set
|
||||
else:
|
||||
model_result_set |= field_result_set
|
||||
|
||||
|
||||
logger.debug('model_result_set: %s' % model_result_set)
|
||||
|
||||
# Update the search result total count
|
||||
@@ -192,7 +191,7 @@ class SearchModel(object):
|
||||
for result in results:
|
||||
if result not in flat_list:
|
||||
flat_list.append(result)
|
||||
|
||||
|
||||
logger.debug('model_list: %s' % model_list)
|
||||
logger.debug('flat_list: %s' % flat_list)
|
||||
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import urlparse
|
||||
import logging
|
||||
import urlparse
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib import messages
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.http import urlencode
|
||||
|
||||
from .conf.settings import SHOW_OBJECT_TYPE
|
||||
from .conf.settings import LIMIT
|
||||
from .classes import SearchModel
|
||||
from .conf.settings import LIMIT, SHOW_OBJECT_TYPE
|
||||
from .forms import SearchForm, AdvancedSearchForm
|
||||
from .models import RecentSearch
|
||||
from .classes import SearchModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
document_search = SearchModel.get('documents.Document')
|
||||
@@ -44,22 +40,22 @@ def results(request, extra_context=None):
|
||||
# Advanced search
|
||||
logger.debug('advanced search')
|
||||
model_list, flat_list, shown_result_count, result_count, elapsed_time = document_search.advanced_search(request.GET)
|
||||
|
||||
|
||||
if shown_result_count != result_count:
|
||||
title = _(u'results, (showing only %(shown_result_count)s out of %(result_count)s)') % {
|
||||
'shown_result_count': shown_result_count,
|
||||
'result_count': result_count}
|
||||
|
||||
|
||||
else:
|
||||
title = _(u'results')
|
||||
|
||||
|
||||
# Update the context with the search results
|
||||
context.update({
|
||||
'found_entries': model_list,
|
||||
'object_list': flat_list,
|
||||
'title': title,
|
||||
'time_delta': elapsed_time,
|
||||
})
|
||||
})
|
||||
|
||||
RecentSearch.objects.add_query_for_user(request.user, request.GET, result_count)
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.api import class_permissions
|
||||
from acls.permissions import ACLS_EDIT_ACL, ACLS_VIEW_ACL
|
||||
from documents.models import Document
|
||||
from documents.permissions import PERMISSION_DOCUMENT_VIEW
|
||||
from navigation.api import (register_links, register_top_menu,
|
||||
register_multi_item_links, register_sidebar_template)
|
||||
|
||||
@@ -14,10 +11,9 @@ from .links import (folder_list, folder_create, folder_edit, folder_delete,
|
||||
folder_add_multiple_documents, document_folder_list, folder_acl_list,
|
||||
folders_main_menu_link)
|
||||
from .models import Folder
|
||||
from .permissions import (PERMISSION_FOLDER_CREATE,
|
||||
PERMISSION_FOLDER_EDIT, PERMISSION_FOLDER_DELETE,
|
||||
PERMISSION_FOLDER_REMOVE_DOCUMENT, PERMISSION_FOLDER_VIEW,
|
||||
PERMISSION_FOLDER_ADD_DOCUMENT)
|
||||
from .permissions import (PERMISSION_FOLDER_EDIT,
|
||||
PERMISSION_FOLDER_DELETE, PERMISSION_FOLDER_REMOVE_DOCUMENT,
|
||||
PERMISSION_FOLDER_VIEW, PERMISSION_FOLDER_ADD_DOCUMENT)
|
||||
|
||||
register_multi_item_links(['folder_view'], [folder_document_multiple_remove])
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.permissions import ACLS_EDIT_ACL, ACLS_VIEW_ACL
|
||||
from acls.permissions import ACLS_VIEW_ACL
|
||||
from documents.permissions import PERMISSION_DOCUMENT_VIEW
|
||||
|
||||
from .permissions import (PERMISSION_FOLDER_CREATE,
|
||||
|
||||
@@ -2,12 +2,11 @@ from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from django.utils import unittest
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.files.base import File
|
||||
from django.utils import unittest
|
||||
|
||||
from documents.literals import VERSION_UPDATE_MAJOR, RELEASE_LEVEL_FINAL
|
||||
from documents.models import Document, DocumentType
|
||||
|
||||
from .models import Folder
|
||||
|
||||
@@ -7,9 +7,9 @@ from navigation.api import register_model_list_columns, register_links
|
||||
from common.utils import encapsulate
|
||||
|
||||
from .models import History
|
||||
from .widgets import history_entry_summary, history_entry_type_link
|
||||
from .widgets import history_entry_type_link
|
||||
from .links import history_list, history_details
|
||||
|
||||
|
||||
register_tool(history_list)
|
||||
|
||||
register_model_list_columns(History, [
|
||||
@@ -24,7 +24,7 @@ register_model_list_columns(History, [
|
||||
{
|
||||
'name': _(u'summary'),
|
||||
'attribute': encapsulate(lambda entry: unicode(entry.get_processed_summary()))
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
register_links(History, [history_details])
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from django.db import models
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
#from django.shortcuts import get_object_or_404
|
||||
from django.db import models
|
||||
|
||||
|
||||
class ObjectHistoryManager(models.Manager):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.db import transaction
|
||||
from django.db.models.signals import post_save
|
||||
from django.db.utils import DatabaseError
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -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('installation', ['Installation'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'Installation'
|
||||
db.delete_table('installation_installation')
|
||||
|
||||
|
||||
models = {
|
||||
'installation.installation': {
|
||||
'Meta': {'object_name': 'Installation'},
|
||||
@@ -33,4 +30,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['installation']
|
||||
complete_apps = ['installation']
|
||||
|
||||
@@ -17,7 +17,7 @@ def namespace_list(request):
|
||||
Installation().get_properties()
|
||||
|
||||
return render_to_response('generic_list.html', {
|
||||
'object_list': PropertyNamespace.get_all(),
|
||||
'object_list': PropertyNamespace.get_all(),
|
||||
'title': _(u'installation property namespaces'),
|
||||
'hide_object': True,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@@ -58,7 +58,8 @@ class SmartLinkImageWidget(forms.widgets.Widget):
|
||||
output.append(u'</div>')
|
||||
output.append(
|
||||
u'<br /><span class="famfam active famfam-magnifier"></span>%s' %
|
||||
ugettext(u'Click on the image for full size view of the first page.'))
|
||||
ugettext(u'Click on the image for full size view of the first page.')
|
||||
)
|
||||
|
||||
return mark_safe(u''.join(output))
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from navigation.api import register_top_menu
|
||||
from navigation.api import register_links
|
||||
from project_setup.api import register_setup
|
||||
from project_tools.api import register_tool
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class_permissions(Document, [
|
||||
])
|
||||
|
||||
register_model_list_columns(Document, [
|
||||
{'name': _(u'metadata'), 'attribute':
|
||||
encapsulate(lambda x: get_metadata_string(x))
|
||||
{
|
||||
'name': _(u'metadata'), 'attribute': encapsulate(lambda x: get_metadata_string(x))
|
||||
},
|
||||
])
|
||||
|
||||
@@ -54,8 +54,7 @@ def save_metadata(metadata_dict, document, create=False):
|
||||
document=document,
|
||||
metadata_type=get_object_or_404(
|
||||
MetadataType,
|
||||
pk=metadata_dict['id']
|
||||
),
|
||||
pk=metadata_dict['id'])
|
||||
)
|
||||
else:
|
||||
try:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -65,7 +64,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.create_unique('metadata_documenttypedefaults_default_metadata', ['documenttypedefaults_id', 'metadatatype_id'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'MetadataType'
|
||||
db.delete_table('metadata_metadatatype')
|
||||
@@ -88,7 +86,6 @@ class Migration(SchemaMigration):
|
||||
# Removing M2M table for field default_metadata on 'DocumentTypeDefaults'
|
||||
db.delete_table('metadata_documenttypedefaults_default_metadata')
|
||||
|
||||
|
||||
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
|
||||
@@ -11,12 +10,10 @@ class Migration(SchemaMigration):
|
||||
# Adding unique constraint on 'MetadataSet', fields ['title']
|
||||
db.create_unique('metadata_metadataset', ['title'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Removing unique constraint on 'MetadataSet', fields ['title']
|
||||
db.delete_unique('metadata_metadataset', ['title'])
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
@@ -137,4 +134,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['metadata']
|
||||
complete_apps = ['metadata']
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
@@ -8,12 +7,10 @@ from django.db import models
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Changing field 'MetadataType.lookup'
|
||||
db.alter_column('metadata_metadatatype', 'lookup', self.gf('django.db.models.fields.TextField')(null=True))
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'MetadataType.lookup'
|
||||
db.alter_column('metadata_metadatatype', 'lookup', self.gf('django.db.models.fields.CharField')(max_length=128, null=True))
|
||||
|
||||
@@ -137,4 +134,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['metadata']
|
||||
complete_apps = ['metadata']
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import
|
||||
|
||||
import copy
|
||||
import re
|
||||
@@ -10,7 +10,7 @@ from django.template import (TemplateSyntaxError, Library,
|
||||
VariableDoesNotExist, Node, Variable)
|
||||
from django.utils.text import unescape_string_literal
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.encoding import smart_str, force_unicode, smart_unicode
|
||||
from django.utils.encoding import smart_str, smart_unicode
|
||||
|
||||
from common.utils import urlquote
|
||||
|
||||
@@ -38,7 +38,7 @@ class TopMenuNavigationNode(Node):
|
||||
for child_path_regex in link.get('children_path_regex', []):
|
||||
if re.compile(child_path_regex).match(current_path.lstrip('/')):
|
||||
menu_links[index]['active'] = True
|
||||
|
||||
|
||||
for children_view_regex in link.get('children_view_regex', []):
|
||||
if re.compile(children_view_regex).match(current_view):
|
||||
menu_links[index]['active'] = True
|
||||
@@ -258,11 +258,11 @@ def object_navigation_template(context):
|
||||
new_context = copy.copy(context)
|
||||
new_context.update({
|
||||
'horizontal': True,
|
||||
'object_navigation_links': _get_object_navigation_links(context)
|
||||
'object_navigation_links': _get_object_navigation_links(context)
|
||||
})
|
||||
return new_context
|
||||
|
||||
|
||||
|
||||
|
||||
@register.tag
|
||||
def get_multi_item_links(parser, token):
|
||||
tag_name, arg = token.contents.split(None, 1)
|
||||
|
||||
@@ -2,11 +2,8 @@ from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.db import transaction
|
||||
from django.db.utils import DatabaseError
|
||||
from django.db.models.signals import post_save, post_syncdb
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.api import class_permissions
|
||||
|
||||
@@ -58,7 +58,6 @@ def queue_document_list(request, queue_name='default'):
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
return render_to_response('generic_list.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation.api import register_top_menu
|
||||
|
||||
from .links import link_tools
|
||||
|
||||
@@ -4,23 +4,18 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.utils import encapsulate
|
||||
from documents.models import Document
|
||||
from documents.permissions import (PERMISSION_DOCUMENT_NEW_VERSION,
|
||||
PERMISSION_DOCUMENT_CREATE)
|
||||
from navigation.api import register_links, register_model_list_columns
|
||||
from project_setup.api import register_setup
|
||||
|
||||
from .links import (document_create_multiple, document_create_siblings,
|
||||
staging_file_preview, staging_file_delete, setup_sources,
|
||||
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_create, setup_source_transformation_edit,
|
||||
setup_source_transformation_delete, source_list, upload_version)
|
||||
staging_file_delete, setup_sources, 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_create,
|
||||
setup_source_transformation_edit, setup_source_transformation_delete,
|
||||
upload_version)
|
||||
from .models import (WebForm, StagingFolder, SourceTransformation,
|
||||
WatchFolder)
|
||||
from .permissions import (PERMISSION_SOURCES_SETUP_VIEW,
|
||||
PERMISSION_SOURCES_SETUP_EDIT, PERMISSION_SOURCES_SETUP_DELETE,
|
||||
PERMISSION_SOURCES_SETUP_CREATE)
|
||||
from .staging import StagingFile
|
||||
from .widgets import staging_file_thumbnail
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from documents.permissions import (PERMISSION_DOCUMENT_NEW_VERSION,
|
||||
PERMISSION_DOCUMENT_CREATE)
|
||||
|
||||
from .models import (WebForm, StagingFolder, SourceTransformation,
|
||||
WatchFolder)
|
||||
from .models import (WebForm, StagingFolder, WatchFolder)
|
||||
from .permissions import (PERMISSION_SOURCES_SETUP_VIEW,
|
||||
PERMISSION_SOURCES_SETUP_EDIT, PERMISSION_SOURCES_SETUP_DELETE,
|
||||
PERMISSION_SOURCES_SETUP_CREATE)
|
||||
|
||||
@@ -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 'StagingFolder'
|
||||
db.create_table('sources_stagingfolder', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@@ -71,9 +71,8 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal('sources', ['OutOfProcess'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
|
||||
# Deleting model 'StagingFolder'
|
||||
db.delete_table('sources_stagingfolder')
|
||||
|
||||
@@ -89,7 +88,6 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'OutOfProcess'
|
||||
db.delete_table('sources_outofprocess')
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -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):
|
||||
|
||||
# Changing field 'StagingFolder.preview_width'
|
||||
db.alter_column('sources_stagingfolder', 'preview_width', self.gf('django.db.models.fields.IntegerField')(default=640))
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Changing field 'StagingFolder.preview_width'
|
||||
db.alter_column('sources_stagingfolder', 'preview_width', self.gf('django.db.models.fields.IntegerField')(null=True))
|
||||
|
||||
|
||||
models = {
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
|
||||
@@ -18,12 +18,10 @@ from acls.models import AccessEntry
|
||||
from common.utils import encapsulate
|
||||
from documents.conf.settings import THUMBNAIL_SIZE
|
||||
from documents.exceptions import NewDocumentVersionNotAllowed
|
||||
from documents.forms import DocumentTypeSelectForm
|
||||
from documents.models import DocumentType, Document
|
||||
from documents.permissions import (PERMISSION_DOCUMENT_CREATE,
|
||||
PERMISSION_DOCUMENT_NEW_VERSION)
|
||||
from metadata.api import decode_metadata_from_url, metadata_repr_as_list
|
||||
from metadata.forms import MetadataSelectionForm, MetadataFormSet
|
||||
from permissions.models import Permission
|
||||
|
||||
from .forms import (SourceTransformationForm, SourceTransformationForm_create,
|
||||
@@ -37,7 +35,6 @@ from .permissions import (PERMISSION_SOURCES_SETUP_VIEW,
|
||||
PERMISSION_SOURCES_SETUP_EDIT, PERMISSION_SOURCES_SETUP_DELETE,
|
||||
PERMISSION_SOURCES_SETUP_CREATE)
|
||||
from .staging import create_staging_file_class
|
||||
from .wizards import DocumentCreateWizard
|
||||
|
||||
|
||||
def document_create_siblings(request, document_id):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Configuration options for the storage app"""
|
||||
import os
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from smart_settings.api import register_settings
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.utils.html import escape, strip_tags
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
import sys
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError, LabelCommand
|
||||
from django.core.management.base import CommandError, LabelCommand
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.utils import IntegrityError
|
||||
|
||||
@@ -80,6 +80,6 @@ class Command(LabelCommand):
|
||||
def _confirm(interactive):
|
||||
if not interactive:
|
||||
return 'yes'
|
||||
return raw_input('You have requested to import a number of users from a CSV file.\n'
|
||||
return raw_input('You have requested to import a number of users from a CSV file.\n'
|
||||
'Are you sure you want to do this?\n'
|
||||
'Type \'yes\' to continue, or any other value to cancel: ')
|
||||
|
||||
Reference in New Issue
Block a user