Improve SourceColumn workflow by allowing explicit functions as columns. Remove usage of encapsulate. Move instances of 'extra_columns' to SourceColumn.

This commit is contained in:
Roberto Rosario
2015-08-16 14:26:41 -04:00
parent 938328bc14
commit 60bc327756
36 changed files with 366 additions and 389 deletions

View File

@@ -4,7 +4,6 @@ from django.utils.translation import ugettext_lazy as _
from acls import ModelPermission
from common import MayanAppConfig, menu_facet, menu_object, menu_sidebar
from common.utils import encapsulate
from documents.models import Document
from navigation import SourceColumn
@@ -37,9 +36,7 @@ class DocumentCommentsApp(MayanAppConfig):
SourceColumn(source=Comment, label=_('Date'), attribute='submit_date')
SourceColumn(
source=Comment, label=_('User'),
attribute=encapsulate(
lambda x: x.user.get_full_name() if x.user.get_full_name() else x.user
)
func=lambda context: context['object'].user.get_full_name() if context['object'].user.get_full_name() else context['object'].user
)
SourceColumn(source=Comment, label=_('Comment'), attribute='comment')