Properly determine which fields to show

This commit is contained in:
Mark Veidemanis 2022-08-11 07:22:22 +01:00
parent 867d86cf6c
commit 47b6255f68
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 1 additions and 8 deletions

View File

@ -178,14 +178,7 @@ class DrilldownTableView(SingleTableView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object_list = self.get_queryset(request) self.object_list = self.get_queryset(request)
show = [] show = []
if len(self.object_list) > 0: show = set().union(*(d.keys() for d in self.object_list))
first = self.object_list[0]
fields = first.keys()
for field in fields:
# values_present = all([x[field] is not None for x in self.object_list])
# if values_present:
if field not in show:
show.append(field)
allow_empty = self.get_allow_empty() allow_empty = self.get_allow_empty()
if not allow_empty: if not allow_empty: