diff --git a/apis_core/apis_entities/detail_views.py b/apis_core/apis_entities/detail_views.py index 11a959e..104047c 100644 --- a/apis_core/apis_entities/detail_views.py +++ b/apis_core/apis_entities/detail_views.py @@ -37,6 +37,13 @@ def get(self, request, *args, **kwargs): table = get_generic_relations_table( relation_class=rel, entity_instance=instance, detail=True ) + print(match, entity) + if match[0] == entity: + link_to_relations = f"{rel.get_listview_url()}?source={pk}" + rel_type = match[1] + else: + link_to_relations = f"{rel.get_listview_url()}?target={pk}" + rel_type = match[0] if match[0] == match[1]: title_card = entity.title() dict_1 = {"related_" + entity.lower() + "a": instance} @@ -69,6 +76,8 @@ def get(self, request, *args, **kwargs): tb_object, "".join([x.title() for x in match]), tb_object_open, + link_to_relations, + rel_type ) ) object_lod = Uri.objects.filter(entity=instance) diff --git a/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html b/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html index 0431b83..e68bafb 100644 --- a/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html +++ b/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html @@ -207,8 +207,8 @@