From 6e4c7501141eaf375328da905cfb4e656dc9f4b5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 30 Apr 2019 18:45:46 +0200 Subject: Import: filter empty entries on m2m such as "my-value & " --- ishtar_common/data_importer.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ishtar_common/data_importer.py') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index b8ab477f1..43c07873e 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1284,6 +1284,12 @@ class Importer(object): many_values = getattr(func, 'many_split', None) if many_values: values = re.split(func.many_split, values[0]) + # filter empty entries on m2m such as "my-value & " + if len(values) > 1: + values = [v for v in values if v.strip()] + if not values: + # keep an empty value if there is only empty values + values = [values[0]] formated_values = [] field_name = formater.field_name -- cgit v1.2.3