From 59c8bbdf2b50896f2604355f6232dc9f51a15edd Mon Sep 17 00:00:00 2001 From: Michael Price Date: Tue, 20 Mar 2018 04:03:17 -0400 Subject: [PATCH] Don't error out when trying to view the index instance list and none has been recalculated. Signed-off-by: Michael Price --- mayan/apps/document_indexing/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mayan/apps/document_indexing/views.py b/mayan/apps/document_indexing/views.py index 9d11e986a1..9fe69dea5c 100644 --- a/mayan/apps/document_indexing/views.py +++ b/mayan/apps/document_indexing/views.py @@ -212,7 +212,6 @@ class TemplateNodeEditView(SingleObjectEditView): class IndexListView(SingleObjectListView): object_permission = permission_document_indexing_view - queryset = IndexInstance.objects.filter(enabled=True) def get_extra_context(self): return { @@ -220,6 +219,10 @@ class IndexListView(SingleObjectListView): 'title': _('Indexes'), } + def get_object_list(self): + queryset = IndexInstance.objects.filter(enabled=True) + return queryset.filter(node_templates__index_instance_nodes__isnull=False).distinct() + class IndexInstanceNodeView(DocumentListView): template_name = 'document_indexing/node_details.html'