From a0a9a2ff3ce9c4b26ec42a051c39f1f4ef4ecd42 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 24 Apr 2020 17:47:09 +0200 Subject: [PATCH] Fix links in event logs view --- logs/models.py | 12 ++++++++++-- logs/templates/logs/aff_stats_logs.html | 6 +++--- logs/views.py | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/logs/models.py b/logs/models.py index 17146389..1def1c01 100644 --- a/logs/models.py +++ b/logs/models.py @@ -67,6 +67,15 @@ class RevisionAction: self.revision = revision self.versions = [VersionAction(v) for v in revision.version_set.all()] + def id(self): + return self.revision.id + + def date_created(self): + return self.revision.date_created + + def comment(self): + return self.revision.get_comment() + class ActionsSearch: def get(self, params): @@ -94,8 +103,7 @@ class ActionsSearch: if action_models: query &= Q(version__content_type__model__in=action_models) - return map( - RevisionAction, + return ( Revision.objects.all() .filter(query) .select_related("user") diff --git a/logs/templates/logs/aff_stats_logs.html b/logs/templates/logs/aff_stats_logs.html index c161cdbd..9fb6a496 100644 --- a/logs/templates/logs/aff_stats_logs.html +++ b/logs/templates/logs/aff_stats_logs.html @@ -46,13 +46,13 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for version in revision.versions %} - + {{ version.name }} - - {{ revision.user }} + + {{ revision.performed_by }} {{ revision.date_created }} diff --git a/logs/views.py b/logs/views.py index 6075d928..26cab9c5 100644 --- a/logs/views.py +++ b/logs/views.py @@ -103,6 +103,7 @@ from re2o.acl import can_view_all, can_view_app, can_edit_history, can_view from .models import ( ActionsSearch, + RevisionAction, MachineHistorySearch, UserHistory, MachineHistory, @@ -176,6 +177,7 @@ def stats_logs(request): pagination_number = GeneralOption.get_cached_value("pagination_number") revisions = re2o_paginator(request, revisions, pagination_number) + revisions = map(RevisionAction, revisions) return render(request, "logs/stats_logs.html", {"revisions_list": revisions}) return render(request, "logs/search_stats_logs.html", {"actions_form": actions_form})