Add and exclude Index instance columns

Exclude inherited columns from the Index models.
Add the label columns to Index instances.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-07-06 04:10:41 -04:00
parent 06c3ef6583
commit 97804b255b
2 changed files with 10 additions and 2 deletions

View File

@@ -100,17 +100,24 @@ class DocumentIndexingApp(MayanAppConfig):
model=IndexInstanceNode, related='index_template_node__index' model=IndexInstanceNode, related='index_template_node__index'
) )
SourceColumn( column_index_label = SourceColumn(
attribute='label', is_identifier=True, is_sortable=True, attribute='label', is_identifier=True, is_sortable=True,
source=Index source=Index
) )
column_index_label.add_exclude(source=IndexInstance)
SourceColumn( SourceColumn(
attribute='label', is_object_absolute_url=True, is_identifier=True,
is_sortable=True, source=IndexInstance
)
column_index_slug = SourceColumn(
attribute='slug', is_sortable=True, source=Index attribute='slug', is_sortable=True, source=Index
) )
SourceColumn( column_index_slug.add_exclude(IndexInstance)
column_index_enabled = SourceColumn(
attribute='enabled', is_sortable=True, source=Index, attribute='enabled', is_sortable=True, source=Index,
widget=TwoStateWidget widget=TwoStateWidget
) )
column_index_enabled.add_exclude(source=IndexInstance)
SourceColumn( SourceColumn(
func=lambda context: context[ func=lambda context: context[

View File

@@ -278,6 +278,7 @@ class IndexListView(SingleObjectListView):
def get_extra_context(self): def get_extra_context(self):
return { return {
'hide_object': True,
'hide_links': True, 'hide_links': True,
'no_results_icon': icon_index, 'no_results_icon': icon_index,
'no_results_main_link': link_index_template_create.resolve( 'no_results_main_link': link_index_template_create.resolve(