Skip to content

Commit

Permalink
fix(utils): create_object_from_uri: raise error if no importer found
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jun 26, 2024
1 parent c60ad36 commit 89b119a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis_core/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django_tables2 import RequestConfig
from django.core.exceptions import ImproperlyConfigured


def get_content_types_with_allowed_relation_from(
Expand Down Expand Up @@ -154,6 +155,8 @@ def create_object_from_uri(uri: str, model: object) -> object:
instance = importer.create_instance()
uri = Uri.objects.create(uri=importer.get_uri, root_object=instance)
return instance
else:
raise ImproperlyConfigured(f"No suitable importer found for {model}")
return None


Expand Down

0 comments on commit 89b119a

Please sign in to comment.