Skip to content

Commit

Permalink
fix(apis_relations): fix entity lookup for multi URI entities
Browse files Browse the repository at this point in the history
primary URI is one that is in the same domain as defined in
APIS_BASE_URI in settings. the default value for APIS_BASE_URI is
hardcoded to be consistent with the same value used in apis_entities at
the time of the creation of the URI object

Closes: #221
  • Loading branch information
gythaogg authored and b1rger committed Sep 26, 2023
1 parent 8aa5394 commit 0febd2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apis_core/apis_relations/forms2.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,14 @@ def load_subj_obj_prop(
self.fields["property"].choices = [property_initial_value]

other_entity_initial_value = (
str(Uri.objects.get(root_object=entity_instance_other)),
str(
Uri.objects.filter(
root_object=entity_instance_other,
uri__startswith=getattr(
settings, "APIS_BASE_URI", "http://apis.info/"
),
).first()
),
f"<span ><small>db</small> {str(entity_instance_other)}</span>",
)
self.fields["other_entity"].initial = other_entity_initial_value
Expand Down

0 comments on commit 0febd2a

Please sign in to comment.