From 049396de820cd4de6e6abb21ac83410f28e580e0 Mon Sep 17 00:00:00 2001
From: csae8092
Date: Tue, 5 Nov 2024 14:20:44 +0100
Subject: [PATCH] some info text if relations are capped
---
apis_core/apis_entities/detail_views.py | 7 ++++++-
.../apis_entities/detail_views/entity_detail_generic.html | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/apis_core/apis_entities/detail_views.py b/apis_core/apis_entities/detail_views.py
index cf47b28..894793f 100644
--- a/apis_core/apis_entities/detail_views.py
+++ b/apis_core/apis_entities/detail_views.py
@@ -64,9 +64,12 @@ def get(self, request, *args, **kwargs):
if callable(getattr(objects, "filter_for_user", None)):
objects = objects.filter_for_user()
disable_sort = False
- if objects.count() > 50:
+ show_more = False
+ object_count = objects.count()
+ if object_count > 50:
objects = objects[:50]
disable_sort = True
+ show_more = True
table = get_generic_relations_table(
relation_class=rel,
entity_instance=instance,
@@ -84,6 +87,8 @@ def get(self, request, *args, **kwargs):
tb_object_open,
link_to_relations,
rel_type,
+ show_more,
+ object_count,
)
)
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 c329808..1800cf1 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,7 +207,7 @@ Beziehungen
{% block relations %}
{% for obj in right_card %}
{% if obj.1.data|length > 0 %}
-
+ {{ obj.0 }} {% if obj.5 %}Gehe zu {{ object }} - {{ obj.5 }} Relationen {% if obj.6 %} aus technischen Gründen werden hier nur 50 von {{ obj.7 }} Relationen angezeigt {% endif %}{% endif %}
{% render_table obj.1 %}