Skip to content

Commit

Permalink
after editing a relation in an enttiy detail view, only show the last…
Browse files Browse the repository at this point in the history
… ten edited relations
  • Loading branch information
csae8092 committed Oct 13, 2024
1 parent 16d45f8 commit 0323efb
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apis_core/apis_relations/forms2.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,11 @@ def get_html_table(self, entity_type, request, site_instance, form_match):
if form_match.group(1) == form_match.group(2):
dic_a = {"related_" + entity_type.lower() + "a": site_instance}
dic_b = {"related_" + entity_type.lower() + "b": site_instance}
if "apis_highlighter" in settings.INSTALLED_APPS:
objects = self.relation_form.objects.filter_ann_proj(
request=request
).filter(Q(**dic_a) | Q(**dic_b))
else:
objects = self.relation_form.objects.filter(Q(**dic_a) | Q(**dic_b))

objects = self.relation_form.objects.filter(Q(**dic_a) | Q(**dic_b)).order_by("-updated")[:10]
table_html = table(data=objects, prefix=prefix)
else:
tab_query = {"related_" + entity_type.lower(): site_instance}
ttab = self.relation_form.objects.filter(**tab_query)
ttab = self.relation_form.objects.filter(**tab_query).order_by("-updated")[:10]
table_html = table(data=ttab, prefix=prefix)
return table_html

Expand Down

0 comments on commit 0323efb

Please sign in to comment.