Refactor the converter app

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>
This commit is contained in:
Roberto Rosario
2019-02-01 04:00:37 -04:00
parent 8e66eefe7c
commit f92d99bd9a
11 changed files with 151 additions and 202 deletions
+13 -5
View File
@@ -1,8 +1,8 @@
from __future__ import unicode_literals
from django.utils.encoding import force_text
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
@@ -25,12 +25,20 @@ class ConverterApp(MayanAppConfig):
Transformation = self.get_model(model_name='Transformation')
SourceColumn(attribute='order', source=Transformation)
ModelPermission.register_inheritance(
model=Transformation, related='content_object'
)
SourceColumn(
source=Transformation, label=_('Transformation'),
func=lambda context: force_text(context['object'])
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
)
SourceColumn(attribute='arguments', source=Transformation)
menu_object.bind_links(
links=(link_transformation_edit, link_transformation_delete),