From 5bd03e63aed891c8f7e1269502d201ad5fbe9408 Mon Sep 17 00:00:00 2001 From: David Kane Date: Mon, 16 Dec 2024 10:27:27 +0000 Subject: [PATCH] fix for cqc data --- other_data/management/commands/import_cqc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/other_data/management/commands/import_cqc.py b/other_data/management/commands/import_cqc.py index 5b0dfbc..da39229 100644 --- a/other_data/management/commands/import_cqc.py +++ b/other_data/management/commands/import_cqc.py @@ -126,6 +126,8 @@ def parse_ods(self, link): for ws_name in wb: if ws_name == "README": continue + if ws_name == "Dual_Registration_Locations": + continue self.logger.info("Loading from sheet '{}'".format(ws_name)) ws = wb[ws_name] headers = None @@ -161,7 +163,9 @@ def parse_row(self, row): # add IDs this_model["CQCLocation"]["provider_id"] = this_model["CQCProvider"]["id"] - if this_model["CQCBrand"]["id"] == "-": + if not this_model["CQCBrand"].get("id"): + this_model["CQCBrand"]["id"] = None + elif this_model["CQCBrand"]["id"] == "-": this_model["CQCBrand"]["id"] = None if this_model["CQCBrand"].get("name", "").startswith("BRAND "): this_model["CQCBrand"]["name"] = this_model["CQCBrand"]["name"][6:]