Add widget support to SourceColumn
Allow passing a widget class to SourceColumn. This makes using lambdas to render model column unnecesary and are mostly removed too. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -57,28 +57,22 @@ class LinkingApp(MayanAppConfig):
|
||||
)
|
||||
|
||||
SourceColumn(
|
||||
source=ResolvedSmartLink, label=_('Label'),
|
||||
func=lambda context: context['object'].get_label_for(
|
||||
document=context['document']
|
||||
)
|
||||
), label=_('Label'), source=ResolvedSmartLink
|
||||
)
|
||||
|
||||
SourceColumn(
|
||||
source=SmartLink, label=_('Dynamic label'),
|
||||
attribute='dynamic_label'
|
||||
attribute='label', is_identifier=True, source=SmartLink
|
||||
)
|
||||
SourceColumn(attribute='dynamic_label', source=SmartLink)
|
||||
SourceColumn(
|
||||
source=SmartLink, label=_('Enabled'),
|
||||
func=lambda context: TwoStateWidget(
|
||||
state=context['object'].enabled
|
||||
).render()
|
||||
attribute='enabled', source=SmartLink, widget=TwoStateWidget
|
||||
)
|
||||
|
||||
SourceColumn(
|
||||
source=SmartLinkCondition, label=_('Enabled'),
|
||||
func=lambda context: TwoStateWidget(
|
||||
state=context['object'].enabled
|
||||
).render()
|
||||
attribute='enabled', source=SmartLinkCondition,
|
||||
widget=TwoStateWidget
|
||||
)
|
||||
|
||||
menu_facet.bind_links(
|
||||
|
||||
@@ -139,7 +139,7 @@ class SmartLinkListView(SingleObjectListView):
|
||||
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'hide_link': True,
|
||||
'hide_object': True,
|
||||
'no_results_icon': icon_smart_link_setup,
|
||||
'no_results_main_link': link_smart_link_create.resolve(
|
||||
context=RequestContext(request=self.request)
|
||||
|
||||
Reference in New Issue
Block a user