diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-11-23 01:11:23 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-11-23 01:11:23 +0100 |
commit | 41b23774811e82c698effce9282a9cd8d8d61f39 (patch) | |
tree | f75845f6c4cb7fe07b0e0b178008d78c0197560d | |
parent | 1a4069089d5ec5adea9b7bdee486784feebc1348 (diff) | |
download | Ishtar-41b23774811e82c698effce9282a9cd8d8d61f39.tar.bz2 Ishtar-41b23774811e82c698effce9282a9cd8d8d61f39.zip |
Importers: fix multiple returned on creation
-rw-r--r-- | ishtar_common/data_importer.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 1614cfa1f..acefd9262 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1347,7 +1347,9 @@ class Importer(object): raise IntegrityError(e.message) except cls.MultipleObjectsReturned: created = False - obj = cls.objects.filter(**create_dict).all()[0] + if 'defaults' in dct: + dct.pop('defaults') + obj = cls.objects.filter(**dct).all()[0] for attr, value in m2ms: values = [value] if type(value) in (list, tuple): |