From 8479d0fc8b83014e03ac105964d4fb7e284413c0 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Tue, 14 Jan 2025 16:21:31 +0100 Subject: [PATCH] fix(importers): adapt importer for changed Uri model --- apis_ontology/importers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apis_ontology/importers.py b/apis_ontology/importers.py index a91d306..c51a22b 100644 --- a/apis_ontology/importers.py +++ b/apis_ontology/importers.py @@ -1,4 +1,5 @@ from django.apps import apps +from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured from django.db.utils import IntegrityError from apis_core.generic.importers import GenericModelImporter @@ -31,7 +32,8 @@ def create_instance(self): subj = self.model.objects.create(**data_croped) if "sameas" in data: for uri in data["sameas"]: - Uri.objects.create(uri=uri, root_object_id=subj.id) + content_type = ContentType.objects.get_for_model(subj) + Uri.objects.create(uri=uri, content_type=content_type, object_id=subj.id) related_keys = [ (x, x.split("__")[1], x.split("__")[2]) for x in data.keys() if "__" in x ]