Don't cache the entire converter class to lower memory usage. Instead a get_converter_class() function is now provided to load the converter backend class. Add model permission inheritance to transformations to removel custom permission checking code in the views. User keyword arguments. Update URL parameters to the '_id' form. Add missing edit and delete icons. Improve the create icon using composition. Update add to comply with MERCs 5 and 6. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from mayan.apps.acls.classes import ModelPermission
|
|
from mayan.apps.common import MayanAppConfig, menu_object, menu_sidebar
|
|
from mayan.apps.navigation import SourceColumn
|
|
|
|
from .links import (
|
|
link_transformation_create, link_transformation_delete,
|
|
link_transformation_edit
|
|
)
|
|
from .licenses import * # NOQA
|
|
|
|
|
|
class ConverterApp(MayanAppConfig):
|
|
app_namespace = 'converter'
|
|
app_url = 'converter'
|
|
has_tests = True
|
|
name = 'mayan.apps.converter'
|
|
verbose_name = _('Converter')
|
|
|
|
def ready(self):
|
|
super(ConverterApp, self).ready()
|
|
|
|
Transformation = self.get_model(model_name='Transformation')
|
|
|
|
ModelPermission.register_inheritance(
|
|
model=Transformation, related='content_object'
|
|
)
|
|
|
|
SourceColumn(
|
|
attribute='order', include_label=True, source=Transformation
|
|
)
|
|
SourceColumn(
|
|
attribute='get_transformation_label', is_identifier=True,
|
|
source=Transformation
|
|
)
|
|
SourceColumn(
|
|
attribute='arguments', include_label=True, source=Transformation
|
|
)
|
|
|
|
menu_object.bind_links(
|
|
links=(link_transformation_edit, link_transformation_delete),
|
|
sources=(Transformation,)
|
|
)
|
|
menu_sidebar.bind_links(
|
|
links=(link_transformation_create,), sources=(Transformation,)
|
|
)
|
|
menu_sidebar.bind_links(
|
|
links=(link_transformation_create,),
|
|
sources=(
|
|
'converter:transformation_create',
|
|
'converter:transformation_list'
|
|
)
|
|
)
|