Code cleanup
This commit is contained in:
@@ -29,6 +29,7 @@ if common_settings.AUTO_CREATE_ADMIN:
|
|||||||
# the "syncdb" command during database creation.)
|
# the "syncdb" command during database creation.)
|
||||||
#
|
#
|
||||||
# Create our own test user automatically.
|
# Create our own test user automatically.
|
||||||
|
|
||||||
def create_testuser(app, created_models, verbosity, **kwargs):
|
def create_testuser(app, created_models, verbosity, **kwargs):
|
||||||
USERNAME = common_settings.AUTO_ADMIN_USERNAME
|
USERNAME = common_settings.AUTO_ADMIN_USERNAME
|
||||||
PASSWORD = common_settings.AUTO_ADMIN_PASSWORD
|
PASSWORD = common_settings.AUTO_ADMIN_PASSWORD
|
||||||
|
|||||||
@@ -111,4 +111,3 @@ class UserForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('first_name', 'last_name')
|
fields = ('first_name', 'last_name')
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,9 @@ class ConverterClass(ConverterBase):
|
|||||||
for format_name in Image.ID:
|
for format_name in Image.ID:
|
||||||
formats.append((format_name, u''))
|
formats.append((format_name, u''))
|
||||||
|
|
||||||
|
#if USE_GHOSTSCRIPT:
|
||||||
|
#PDF, PS
|
||||||
|
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
def get_available_transformations(self):
|
def get_available_transformations(self):
|
||||||
@@ -147,30 +150,30 @@ class ConverterClass(ConverterBase):
|
|||||||
'''
|
'''
|
||||||
#preresize image with factor 2, 4, 8 and fast algorithm
|
#preresize image with factor 2, 4, 8 and fast algorithm
|
||||||
factor = 1
|
factor = 1
|
||||||
while img.size[0]/factor > 2*box[0] and img.size[1]*2/factor > 2*box[1]:
|
while img.size[0]/factor > 2 * box[0] and img.size[1] * 2/factor > 2 * box[1]:
|
||||||
factor *=2
|
factor *=2
|
||||||
if factor > 1:
|
if factor > 1:
|
||||||
img.thumbnail((img.size[0]/factor, img.size[1]/factor), Image.NEAREST)
|
img.thumbnail((img.size[0] / factor, img.size[1] / factor), Image.NEAREST)
|
||||||
|
|
||||||
#calculate the cropping box and get the cropped part
|
#calculate the cropping box and get the cropped part
|
||||||
if fit:
|
if fit:
|
||||||
x1 = y1 = 0
|
x1 = y1 = 0
|
||||||
x2, y2 = img.size
|
x2, y2 = img.size
|
||||||
wRatio = 1.0 * x2/box[0]
|
wRatio = 1.0 * x2 / box[0]
|
||||||
hRatio = 1.0 * y2/box[1]
|
hRatio = 1.0 * y2 / box[1]
|
||||||
if hRatio > wRatio:
|
if hRatio > wRatio:
|
||||||
y1 = y2/2-box[1]*wRatio/2
|
y1 = y2 / 2 - box[1] * wRatio / 2
|
||||||
y2 = y2/2+box[1]*wRatio/2
|
y2 = y2 / 2 + box[1] * wRatio / 2
|
||||||
else:
|
else:
|
||||||
x1 = x2/2-box[0]*hRatio/2
|
x1 = x2 / 2 - box[0] * hRatio / 2
|
||||||
x2 = x2/2+box[0]*hRatio/2
|
x2 = x2 / 2 + box[0] * hRatio / 2
|
||||||
img = img.crop((x1,y1,x2,y2))
|
img = img.crop((x1, y1, x2, y2))
|
||||||
|
|
||||||
#Resize the image with best quality algorithm ANTI-ALIAS
|
#Resize the image with best quality algorithm ANTI-ALIAS
|
||||||
img.thumbnail(box, Image.ANTIALIAS)
|
img.thumbnail(box, Image.ANTIALIAS)
|
||||||
|
|
||||||
if out:
|
if out:
|
||||||
#save it into a file-like object
|
#save it into a file-like object
|
||||||
img.save(out, "JPEG", quality=75)
|
img.save(out, 'JPEG', quality=75)
|
||||||
else:
|
else:
|
||||||
return img
|
return img
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from common.utils import validate_path
|
from common.utils import validate_path
|
||||||
from navigation.api import register_links, register_top_menu, \
|
from navigation.api import register_links, register_top_menu, \
|
||||||
@@ -28,6 +26,7 @@ from documents.conf.settings import ZOOM_MIN_LEVEL
|
|||||||
from documents.conf.settings import CACHE_PATH
|
from documents.conf.settings import CACHE_PATH
|
||||||
from documents.widgets import document_thumbnail
|
from documents.widgets import document_thumbnail
|
||||||
|
|
||||||
|
|
||||||
# Document page links expressions
|
# Document page links expressions
|
||||||
def is_first_page(context):
|
def is_first_page(context):
|
||||||
return context['object'].page_number <= 1
|
return context['object'].page_number <= 1
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from taggit.managers import TaggableManager
|
|||||||
from dynamic_search.api import register
|
from dynamic_search.api import register
|
||||||
from converter.api import get_page_count
|
from converter.api import get_page_count
|
||||||
from converter.api import get_available_transformations_choices
|
from converter.api import get_available_transformations_choices
|
||||||
from converter.api import create_image_cache_filename, convert
|
from converter.api import convert
|
||||||
from converter.exceptions import UnknownFormat, UnkownConvertError
|
from converter.exceptions import UnknownFormat, UnkownConvertError
|
||||||
|
|
||||||
from documents.utils import get_document_mimetype
|
from documents.utils import get_document_mimetype
|
||||||
@@ -21,7 +21,6 @@ from documents.conf.settings import CHECKSUM_FUNCTION
|
|||||||
from documents.conf.settings import UUID_FUNCTION
|
from documents.conf.settings import UUID_FUNCTION
|
||||||
from documents.conf.settings import STORAGE_BACKEND
|
from documents.conf.settings import STORAGE_BACKEND
|
||||||
from documents.conf.settings import PREVIEW_SIZE
|
from documents.conf.settings import PREVIEW_SIZE
|
||||||
from documents.conf.settings import THUMBNAIL_SIZE
|
|
||||||
from documents.conf.settings import CACHE_PATH
|
from documents.conf.settings import CACHE_PATH
|
||||||
|
|
||||||
from documents.managers import RecentDocumentManager, \
|
from documents.managers import RecentDocumentManager, \
|
||||||
@@ -30,7 +29,7 @@ from documents.utils import document_save_to_temp_dir
|
|||||||
from documents.literals import PICTURE_ERROR_SMALL, PICTURE_ERROR_MEDIUM, \
|
from documents.literals import PICTURE_ERROR_SMALL, PICTURE_ERROR_MEDIUM, \
|
||||||
PICTURE_UNKNOWN_SMALL, PICTURE_UNKNOWN_MEDIUM
|
PICTURE_UNKNOWN_SMALL, PICTURE_UNKNOWN_MEDIUM
|
||||||
from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
|
from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
|
||||||
DEFAULT_FILE_FORMAT, DEFAULT_PAGE_NUMBER
|
DEFAULT_PAGE_NUMBER
|
||||||
|
|
||||||
# document image cache name hash function
|
# document image cache name hash function
|
||||||
HASH_FUNCTION = lambda x: hashlib.sha256(x).hexdigest()
|
HASH_FUNCTION = lambda x: hashlib.sha256(x).hexdigest()
|
||||||
@@ -243,7 +242,7 @@ class Document(models.Model):
|
|||||||
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_UNKNOWN_SMALL)
|
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_UNKNOWN_SMALL)
|
||||||
except UnkownConvertError:
|
except UnkownConvertError:
|
||||||
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_ERROR_SMALL)
|
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_ERROR_SMALL)
|
||||||
except Exception, e:
|
except:
|
||||||
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_ERROR_SMALL)
|
output_file = os.path.join(settings.MEDIA_ROOT, u'images', PICTURE_ERROR_SMALL)
|
||||||
return output_file
|
return output_file
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from django.template import Library, Node, Variable
|
|||||||
|
|
||||||
from converter.api import get_document_dimensions
|
from converter.api import get_document_dimensions
|
||||||
|
|
||||||
from documents.views import calculate_converter_arguments
|
|
||||||
from documents.conf.settings import PRINT_SIZE
|
from documents.conf.settings import PRINT_SIZE
|
||||||
|
|
||||||
register = Library()
|
register = Library()
|
||||||
|
|||||||
+3
-10
@@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import urlparse
|
import urlparse
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
@@ -10,7 +9,6 @@ from django.contrib import messages
|
|||||||
from django.views.generic.list_detail import object_list
|
from django.views.generic.list_detail import object_list
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.views.generic.create_update import delete_object, update_object
|
from django.views.generic.create_update import delete_object, update_object
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
|
||||||
import sendfile
|
import sendfile
|
||||||
@@ -24,8 +22,6 @@ from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
|
|||||||
DEFAULT_FILE_FORMAT, DEFAULT_PAGE_NUMBER
|
DEFAULT_FILE_FORMAT, DEFAULT_PAGE_NUMBER
|
||||||
from filetransfers.api import serve_file
|
from filetransfers.api import serve_file
|
||||||
from grouping.utils import get_document_group_subtemplate
|
from grouping.utils import get_document_group_subtemplate
|
||||||
from metadata.api import save_metadata_list, \
|
|
||||||
decode_metadata_from_url, metadata_repr_as_list
|
|
||||||
from metadata.forms import MetadataFormSet, MetadataSelectionForm
|
from metadata.forms import MetadataFormSet, MetadataSelectionForm
|
||||||
from navigation.utils import resolve_to_name
|
from navigation.utils import resolve_to_name
|
||||||
from permissions.api import check_permissions
|
from permissions.api import check_permissions
|
||||||
@@ -33,7 +29,6 @@ from document_indexing.api import update_indexes, delete_indexes
|
|||||||
from history.api import create_history
|
from history.api import create_history
|
||||||
|
|
||||||
from documents.conf.settings import PREVIEW_SIZE
|
from documents.conf.settings import PREVIEW_SIZE
|
||||||
from documents.conf.settings import THUMBNAIL_SIZE
|
|
||||||
from documents.conf.settings import STORAGE_BACKEND
|
from documents.conf.settings import STORAGE_BACKEND
|
||||||
from documents.conf.settings import ZOOM_PERCENT_STEP
|
from documents.conf.settings import ZOOM_PERCENT_STEP
|
||||||
from documents.conf.settings import ZOOM_MAX_LEVEL
|
from documents.conf.settings import ZOOM_MAX_LEVEL
|
||||||
@@ -52,7 +47,7 @@ from documents.literals import HISTORY_DOCUMENT_CREATED, \
|
|||||||
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED
|
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED
|
||||||
|
|
||||||
from documents.forms import DocumentTypeSelectForm, \
|
from documents.forms import DocumentTypeSelectForm, \
|
||||||
DocumentForm, DocumentForm_edit, DocumentPropertiesForm, \
|
DocumentForm_edit, DocumentPropertiesForm, \
|
||||||
DocumentPreviewForm, \
|
DocumentPreviewForm, \
|
||||||
DocumentPageForm, DocumentPageTransformationForm, \
|
DocumentPageForm, DocumentPageTransformationForm, \
|
||||||
DocumentContentForm, DocumentPageForm_edit, \
|
DocumentContentForm, DocumentPageForm_edit, \
|
||||||
@@ -61,8 +56,6 @@ from documents.forms import DocumentTypeSelectForm, \
|
|||||||
from documents.wizards import DocumentCreateWizard
|
from documents.wizards import DocumentCreateWizard
|
||||||
from documents.models import Document, DocumentType, DocumentPage, \
|
from documents.models import Document, DocumentType, DocumentPage, \
|
||||||
DocumentPageTransformation, RecentDocument, DocumentTypeFilename
|
DocumentPageTransformation, RecentDocument, DocumentTypeFilename
|
||||||
from documents.literals import PICTURE_ERROR_SMALL, PICTURE_ERROR_MEDIUM, \
|
|
||||||
PICTURE_UNKNOWN_SMALL, PICTURE_UNKNOWN_MEDIUM
|
|
||||||
|
|
||||||
# Document type permissions
|
# Document type permissions
|
||||||
from documents.literals import PERMISSION_DOCUMENT_TYPE_EDIT, \
|
from documents.literals import PERMISSION_DOCUMENT_TYPE_EDIT, \
|
||||||
@@ -779,10 +772,10 @@ def document_hard_copy(request, document_id):
|
|||||||
|
|
||||||
RecentDocument.objects.add_document_for_user(request.user, document)
|
RecentDocument.objects.add_document_for_user(request.user, document)
|
||||||
|
|
||||||
arguments, warnings = calculate_converter_arguments(document, size=PRINT_SIZE, file_format=DEFAULT_FILE_FORMAT)
|
#arguments, warnings = calculate_converter_arguments(document, size=PRINT_SIZE, file_format=DEFAULT_FILE_FORMAT)
|
||||||
|
|
||||||
# Pre-generate
|
# Pre-generate
|
||||||
convert_document(document, **arguments)
|
#convert_document(document, **arguments)
|
||||||
|
|
||||||
# Extract dimension values ignoring any unit
|
# Extract dimension values ignoring any unit
|
||||||
page_width = request.GET.get('page_width', dict(PAGE_SIZE_DIMENSIONS)[DEFAULT_PAPER_SIZE][0])
|
page_width = request.GET.get('page_width', dict(PAGE_SIZE_DIMENSIONS)[DEFAULT_PAPER_SIZE][0])
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import urlparse
|
import urlparse
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ from django.template import TemplateSyntaxError, Library, \
|
|||||||
from django.utils.text import unescape_string_literal
|
from django.utils.text import unescape_string_literal
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from django.template import Context
|
|
||||||
|
|
||||||
from common.utils import urlquote
|
from common.utils import urlquote
|
||||||
|
|
||||||
from navigation.api import object_navigation, multi_object_navigation, \
|
from navigation.api import object_navigation, multi_object_navigation, \
|
||||||
@@ -203,7 +201,6 @@ def _get_object_navigation_links(context, menu_name=None, links_dict=object_navi
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
return context_links
|
return context_links
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -96,7 +96,7 @@ def do_document_ocr(queue_document):
|
|||||||
unpaper_output_filename = u'%s_unpaper_out_page_%s%s%s' % (document_page.document.uuid, document_page.page_number, os.extsep, UNPAPER_FILE_FORMAT)
|
unpaper_output_filename = u'%s_unpaper_out_page_%s%s%s' % (document_page.document.uuid, document_page.page_number, os.extsep, UNPAPER_FILE_FORMAT)
|
||||||
unpaper_output_filepath = os.path.join(TEMPORARY_DIRECTORY, unpaper_output_filename)
|
unpaper_output_filepath = os.path.join(TEMPORARY_DIRECTORY, unpaper_output_filename)
|
||||||
|
|
||||||
unpaper_input=convert(document_filepath, file_format=UNPAPER_FILE_FORMAT)
|
unpaper_input = convert(document_filepath, file_format=UNPAPER_FILE_FORMAT)
|
||||||
execute_unpaper(input_filepath=unpaper_input, output_filepath=unpaper_output_filepath)
|
execute_unpaper(input_filepath=unpaper_input, output_filepath=unpaper_output_filepath)
|
||||||
|
|
||||||
#from PIL import Image, ImageOps
|
#from PIL import Image, ImageOps
|
||||||
@@ -108,7 +108,7 @@ def do_document_ocr(queue_document):
|
|||||||
#im.save(unpaper_output_filepath)
|
#im.save(unpaper_output_filepath)
|
||||||
|
|
||||||
# Convert to TIFF
|
# Convert to TIFF
|
||||||
pre_ocr_filepath = output_filepath=convert(input_filepath=unpaper_output_filepath, file_format=DEFAULT_OCR_FILE_FORMAT)
|
pre_ocr_filepath = convert(input_filepath=unpaper_output_filepath, file_format=DEFAULT_OCR_FILE_FORMAT)
|
||||||
# Tesseract needs an explicit file extension
|
# Tesseract needs an explicit file extension
|
||||||
pre_ocr_filepath_w_ext = os.extsep.join([pre_ocr_filepath, DEFAULT_OCR_FILE_EXTENSION])
|
pre_ocr_filepath_w_ext = os.extsep.join([pre_ocr_filepath, DEFAULT_OCR_FILE_EXTENSION])
|
||||||
os.rename(pre_ocr_filepath, pre_ocr_filepath_w_ext)
|
os.rename(pre_ocr_filepath, pre_ocr_filepath_w_ext)
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
from django.utils.translation import ugettext
|
|
||||||
|
|
||||||
from ocr.models import QueueTransformation
|
from ocr.models import QueueTransformation
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
import codecs
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import slate
|
import slate
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|||||||
@@ -18,5 +18,4 @@ urlpatterns = patterns('ocr.views',
|
|||||||
url(r'^queue/(?P<document_queue_id>\w+)/transformation/create/$', 'setup_queue_transformation_create', (), 'setup_queue_transformation_create'),
|
url(r'^queue/(?P<document_queue_id>\w+)/transformation/create/$', 'setup_queue_transformation_create', (), 'setup_queue_transformation_create'),
|
||||||
url(r'^queue/transformation/(?P<transformation_id>\w+)/edit/$', 'setup_queue_transformation_edit', (), 'setup_queue_transformation_edit'),
|
url(r'^queue/transformation/(?P<transformation_id>\w+)/edit/$', 'setup_queue_transformation_edit', (), 'setup_queue_transformation_edit'),
|
||||||
url(r'^queue/transformation/(?P<transformation_id>\w+)/delete/$', 'setup_queue_transformation_delete', (), 'setup_queue_transformation_delete'),
|
url(r'^queue/transformation/(?P<transformation_id>\w+)/delete/$', 'setup_queue_transformation_delete', (), 'setup_queue_transformation_delete'),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -429,7 +429,6 @@ def setup_queue_transformation_create(request, document_queue_id):
|
|||||||
document_queue = get_object_or_404(DocumentQueue, pk=document_queue_id)
|
document_queue = get_object_or_404(DocumentQueue, pk=document_queue_id)
|
||||||
|
|
||||||
redirect_view = reverse('setup_queue_transformation_list', args=[document_queue.pk])
|
redirect_view = reverse('setup_queue_transformation_list', args=[document_queue.pk])
|
||||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', redirect_view)))
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = QueueTransformationForm_create(request.POST)
|
form = QueueTransformationForm_create(request.POST)
|
||||||
@@ -458,4 +457,3 @@ def setup_queue_transformation_create(request, document_queue_id):
|
|||||||
'navigation_object_name': 'queue',
|
'navigation_object_name': 'queue',
|
||||||
'title': _(u'Create new transformation for queue: %s') % document_queue,
|
'title': _(u'Create new transformation for queue: %s') % document_queue,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext
|
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from django.contrib.contenttypes.models import ContentType
|
|||||||
from django.contrib.contenttypes import generic
|
from django.contrib.contenttypes import generic
|
||||||
|
|
||||||
from documents.models import DocumentType
|
from documents.models import DocumentType
|
||||||
from documents.managers import RecentDocumentManager
|
|
||||||
from metadata.models import MetadataType
|
from metadata.models import MetadataType
|
||||||
from converter.api import get_available_transformations_choices
|
from converter.api import get_available_transformations_choices
|
||||||
from converter.literals import DIMENSION_SEPARATOR
|
from converter.literals import DIMENSION_SEPARATOR
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import hashlib
|
|||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
from django.contrib import messages
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from converter.api import convert, cache_cleanup
|
from converter.api import convert, cache_cleanup
|
||||||
|
|||||||
@@ -596,24 +596,7 @@ def setup_source_transformation_create(request, source_type, source_id):
|
|||||||
|
|
||||||
source = get_object_or_404(cls, pk=source_id)
|
source = get_object_or_404(cls, pk=source_id)
|
||||||
|
|
||||||
context = {
|
|
||||||
'object_list': SourceTransformation.objects.get_for_object(source),
|
|
||||||
'title': _(u'transformations for: %s') % source.fullname(),
|
|
||||||
'source': source,
|
|
||||||
'object_name': _(u'source'),
|
|
||||||
'navigation_object_name': 'source',
|
|
||||||
'list_object_variable_name': 'transformation',
|
|
||||||
'extra_columns': [
|
|
||||||
{'name': _(u'order'), 'attribute': 'order'},
|
|
||||||
{'name': _(u'transformation'), 'attribute': lambda x: x.get_transformation_display()},
|
|
||||||
{'name': _(u'arguments'), 'attribute': 'arguments'}
|
|
||||||
],
|
|
||||||
'hide_link': True,
|
|
||||||
'hide_object': True,
|
|
||||||
}
|
|
||||||
|
|
||||||
redirect_view = reverse('setup_source_transformation_list', args=[source.source_type, source.pk])
|
redirect_view = reverse('setup_source_transformation_list', args=[source.source_type, source.pk])
|
||||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', redirect_view)))
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = SourceTransformationForm_create(request.POST)
|
form = SourceTransformationForm_create(request.POST)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from navigation.api import register_links, register_top_menu, \
|
from navigation.api import register_links, register_top_menu, \
|
||||||
register_model_list_columns, register_multi_item_links
|
register_model_list_columns, register_multi_item_links
|
||||||
from permissions.api import register_permission, set_namespace_title
|
from permissions.api import register_permission, set_namespace_title
|
||||||
from navigation.api import register_sidebar_template
|
|
||||||
|
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
|
|
||||||
|
|||||||
@@ -284,4 +284,3 @@ def tag_remove(request, document_id, tag_id=None, tag_id_list=None):
|
|||||||
|
|
||||||
def tag_multiple_remove(request, document_id):
|
def tag_multiple_remove(request, document_id):
|
||||||
return tag_remove(request, document_id=document_id, tag_id_list=request.GET.get('id_list', []))
|
return tag_remove(request, document_id=document_id, tag_id_list=request.GET.get('id_list', []))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user