From 42d06b2ba39cc8d2ba9fe23edb5c8ed09a75c2ab Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 24 Apr 2020 16:45:37 +0000 Subject: [PATCH] Limit length of displayed diff --- logs/templates/logs/aff_stats_logs.html | 6 +++--- logs/views.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/logs/templates/logs/aff_stats_logs.html b/logs/templates/logs/aff_stats_logs.html index ffb296ca..3ba37958 100644 --- a/logs/templates/logs/aff_stats_logs.html +++ b/logs/templates/logs/aff_stats_logs.html @@ -71,11 +71,11 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ edit.0 }}
{% elif edit.1 is None %} {{ edit.0 }}: - {{ edit.2 }}
+ {{ edit.2|truncatechars:50 }}
{% else %} {{ edit.0 }}: - {{ edit.1 }} - ➔ {{ edit.2 }}
+ {{ edit.1|truncatechars:50 }} + ➔ {{ edit.2|truncatechars:50 }}
{% endif %} {% endfor %} diff --git a/logs/views.py b/logs/views.py index 26cab9c5..b71187aa 100644 --- a/logs/views.py +++ b/logs/views.py @@ -177,7 +177,10 @@ def stats_logs(request): pagination_number = GeneralOption.get_cached_value("pagination_number") revisions = re2o_paginator(request, revisions, pagination_number) - revisions = map(RevisionAction, revisions) + + # Only do this now so it's not applied to objects which aren't displayed + # It can take a bit of time because it has to compute the diff of each version + revisions.object_list = [RevisionAction(r) for r in revisions.object_list] return render(request, "logs/stats_logs.html", {"revisions_list": revisions}) return render(request, "logs/search_stats_logs.html", {"actions_form": actions_form})