diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-26 16:46:02 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-26 16:46:02 +0200 |
commit | 54ed63e5995c974ff93ecd7f2221d891f5e3b906 (patch) | |
tree | 3a0eca073bce32ab265be1932f6c6192b7d0d7dc /ishtar_common/data_importer.py | |
parent | 99ff63e51bff5b877ebae0ff0808c8118541ed55 (diff) | |
download | Ishtar-54ed63e5995c974ff93ecd7f2221d891f5e3b906.tar.bz2 Ishtar-54ed63e5995c974ff93ecd7f2221d891f5e3b906.zip |
Import: fix default management for M2M
Diffstat (limited to 'ishtar_common/data_importer.py')
-rw-r--r-- | ishtar_common/data_importer.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 9ac624bbd..2680cb05b 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1495,6 +1495,11 @@ class Importer(object): if self.MODEL_CREATION_LIMIT and \ model not in self.MODEL_CREATION_LIMIT: raise self._get_improperly_conf_error(model) + if "defaults" in v: + default_values = v.pop("defaults") + for k in default_values.keys(): + if k not in v: + v[k] = default_values[k] v = model.objects.create(**v) else: continue |