Skip to content

Commit

Permalink
fix(importers): adapt importer for changed Uri model
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jan 14, 2025
1 parent 82a2cbd commit d90897e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apis_ontology/importers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,7 +32,10 @@ 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
]
Expand Down

0 comments on commit d90897e

Please sign in to comment.