8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Fix links in event logs view

This commit is contained in:
Jean-Romain Garnier 2020-04-24 17:47:09 +02:00 committed by Gabriel Detraz
parent e54026c40a
commit ed086ae255
3 changed files with 15 additions and 5 deletions

View file

@ -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")

View file

@ -46,13 +46,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for version in revision.versions %}
<tr>
<td>
<a href="{% url 'logs:history' revision.application revision.model_name revision.object_id %}" title="{% trans "History" %}">
<a href="{% url 'logs:history' version.application version.model_name version.object_id %}" title="{% trans "History" %}">
{{ version.name }}
</a>
</td>
<td>
<a href="{% url 'users:profil' userid=revision.user.id %}" title=tr_view_the_profile>
{{ revision.user }}
<a href="{% url 'users:profil' userid=revision.performed_by.id %}" title=tr_view_the_profile>
{{ revision.performed_by }}
</a>
</td>
<td>{{ revision.date_created }}</td>

View file

@ -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})