Skip to content

Commit

Permalink
feat(apis_entities): update AbstractEntity to work with generic uri
Browse files Browse the repository at this point in the history
The Uri model now uses a generic foreign key instead of the direct
foreign key to the RootObject. This commit updates all occurences
of `root_object` to use the generic foreign key instead.
  • Loading branch information
b1rger committed Dec 17, 2024
1 parent 2299b1e commit afe2167
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apis_core/apis_entities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ def create_default_uri(sender, instance, created, raw, using, update_fields, **k
"apis_core:GetEntityGeneric", kwargs={"pk": instance.pk}
)
uri = f"{base}{route}"
Uri.objects.create(uri=uri, root_object=instance)
content_type = ContentType.objects.get_for_model(instance)
Uri.objects.create(
uri=uri,
content_type=content_type,
object_id=instance.id,
)

0 comments on commit afe2167

Please sign in to comment.