From f55ae8b34dac5e08660536f8d369b5fe5754ecc7 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Thu, 28 Nov 2024 12:11:14 +0000 Subject: [PATCH] allow json import config to have multiple data types for one set Lets you define range imports with the minimum of duplicated config --- hub/management/commands/import_from_config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hub/management/commands/import_from_config.py b/hub/management/commands/import_from_config.py index 9bf920935..5f977806f 100644 --- a/hub/management/commands/import_from_config.py +++ b/hub/management/commands/import_from_config.py @@ -47,7 +47,14 @@ def get_configs(self, import_name): c = json.load(config) for conf in c: if conf["name"] == import_name: - confs.append(conf) + if conf.get("data_types"): + conf["data_set_name"] = conf["name"] + conf["data_set_label"] = conf["label"] + for dt in conf["data_types"]: + dt_conf = {**conf, **dt} + confs.append(dt_conf) + else: + confs.append(conf) return confs