From 4bdb574817e87cb847b89c1a0bfea38736db81c0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 28 Dec 2015 17:10:09 +0100 Subject: Imports: default values for many to many --- ishtar_common/data_importer.py | 9 +++++++++ ishtar_common/models.py | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 34f8ebec8..09ef64c26 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1180,6 +1180,15 @@ class Importer(object): # contruct many dict for each values default_dict = {} + + # # get default values + p = [attribute] + if c_path: + p = list(c_path) + p + p = tuple(p) + if p in self._defaults: + for k in self._defaults[p]: + default_dict[k] = self._defaults[p][k] # # init with simple values that will be duplicated for key in val.keys(): if type(val[key]) not in (list, tuple): diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c657f532d..f720dc5ab 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1539,7 +1539,8 @@ TARGET_MODELS = [ ('archaeological_finds.models.PreservationType', _(u"Preservation type")), ('archaeological_finds.models.ObjectType', _(u"Object type")), ('archaeological_context_records.models.IdentificationType', - _("Identification type")) + _("Identification type")), + ('SupportType', _(u"Support type")), ] TARGET_MODELS_KEYS = [tm[0] for tm in TARGET_MODELS] -- cgit v1.2.3