Remove use of extra_columns and move logic to app.py module.
This commit is contained in:
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common import MayanAppConfig, menu_object, menu_sidebar
|
||||
from common.utils import encapsulate
|
||||
from navigation import SourceColumn
|
||||
|
||||
from .links import (
|
||||
link_transformation_create, link_transformation_delete,
|
||||
@@ -18,6 +20,17 @@ class ConverterApp(MayanAppConfig):
|
||||
def ready(self):
|
||||
super(ConverterApp, self).ready()
|
||||
|
||||
SourceColumn(source=Transformation, label=_('Order'), attribute='order')
|
||||
SourceColumn(
|
||||
source=Transformation, label=_('Transformation'),
|
||||
attribute=encapsulate(
|
||||
lambda transformation: unicode(transformation)
|
||||
)
|
||||
)
|
||||
SourceColumn(
|
||||
source=Transformation, label=_('Arguments'), attribute='arguments'
|
||||
)
|
||||
|
||||
menu_object.bind_links(
|
||||
links=(link_transformation_edit, link_transformation_delete),
|
||||
sources=(Transformation,)
|
||||
|
||||
@@ -10,7 +10,6 @@ from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.models import AccessControlList
|
||||
from common.utils import encapsulate
|
||||
from common.views import (
|
||||
SingleObjectCreateView, SingleObjectDeleteView, SingleObjectEditView,
|
||||
SingleObjectListView
|
||||
@@ -231,15 +230,6 @@ class TransformationListView(SingleObjectListView):
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'content_object': self.content_object,
|
||||
'extra_columns': [
|
||||
{'name': _('Order'), 'attribute': 'order'},
|
||||
{
|
||||
'name': _('Transformation'), 'attribute': encapsulate(
|
||||
lambda transformation: unicode(transformation)
|
||||
)
|
||||
},
|
||||
{'name': _('Arguments'), 'attribute': 'arguments'}
|
||||
],
|
||||
'hide_link': True,
|
||||
'hide_object': True,
|
||||
'navigation_object_list': ('content_object',),
|
||||
|
||||
Reference in New Issue
Block a user