From 841d849e38e9a9ce8bd2a12b2e204a4a80fa1829 Mon Sep 17 00:00:00 2001 From: thenav56 Date: Tue, 30 Apr 2019 18:54:01 +0545 Subject: [PATCH] Fill geo cells in excel export if geo is missing --- apps/export/entries/excel_exporter.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/export/entries/excel_exporter.py b/apps/export/entries/excel_exporter.py index e9f1408fba..0edc53e437 100644 --- a/apps/export/entries/excel_exporter.py +++ b/apps/export/entries/excel_exporter.py @@ -209,17 +209,19 @@ def add_entries_from_excel_data(self, rows, data, export_data): else: row_values.extend(['', '']) rows_value.append(row_values[::-1]) - rows.add_rows_of_value_lists(rows_value) + if len(rows_value) > 0: + rows.add_rows_of_value_lists(rows_value) + else: + rows.add_rows_of_value_lists([['' for i in range(0, max_levels)] * 2]) else: if export_data: if export_data.get('type') == 'list': - rows.add_rows_of_values( + row_values = [ # This is in hope of filtering out non-existent data from excel row - [ - x for x in export_data.get('value', []) - if x is not None - ] - ) + x for x in export_data.get('value', []) + if x is not None + ] + rows.add_rows_of_values(row_values if row_values else ['']) else: rows.add_value(export_data.get('value')) else: