Skip to content

Commit

Permalink
link to filtered relation view
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Oct 13, 2024
1 parent 0323efb commit c7cd7f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions apis_core/apis_entities/detail_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ <h3 class="text-center mt-5">Beziehungen</h3>
{% block relations %}
{% for obj in right_card %}
{% if obj.1.data|length > 0 %}
<h4 > {{ obj.0 }}</h4>
<h4>{{ obj.0 }} <a class="apis-{{ obj.5 }}" title="Gehe zu {{ object }}–{{ obj.0 }} Relationen" href="{{ obj.4 }}"><i class="bi bi-box-arrow-up-right" aria-hidden="true"><span class="visually-hidden">Gehe zu {{ object }} - {{ obj.5 }} Relationen</span></i></a></h4>

<div id="tab_{{ obj.2 }}" class="mb-5">
{% render_table obj.1 %}
</div>
Expand Down

0 comments on commit c7cd7f1

Please sign in to comment.