From e4ec78216457b908d76e1c4a2c8840216c3a66bf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 14 Sep 2025 16:58:44 +0200 Subject: 🐛 import: do not create m2m item when no value is provided MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/data_importer.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 2e923925f..7b652b792 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1798,6 +1798,8 @@ class Importer(object): not self.MODEL_CREATION_LIMIT or model in self.MODEL_CREATION_LIMIT ): + if not any(v.values()): # empty + continue try: v, created = model.objects.get_or_create(**v) except FieldError as e: @@ -1814,6 +1816,8 @@ class Importer(object): get_v = v.copy() if "defaults" in get_v: get_v.pop("defaults") + if not any(get_v.values()): # empty + continue try: v = model.objects.get(**get_v) except model.DoesNotExist: -- cgit v1.2.3