8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +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 chirac
parent f54eaaeb0d
commit db9e2d7c1f
3 changed files with 15 additions and 5 deletions

View file

@ -67,6 +67,15 @@ class RevisionAction:
self.revision = revision self.revision = revision
self.versions = [VersionAction(v) for v in revision.version_set.all()] 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: class ActionsSearch:
def get(self, params): def get(self, params):
@ -94,8 +103,7 @@ class ActionsSearch:
if action_models: if action_models:
query &= Q(version__content_type__model__in=action_models) query &= Q(version__content_type__model__in=action_models)
return map( return (
RevisionAction,
Revision.objects.all() Revision.objects.all()
.filter(query) .filter(query)
.select_related("user") .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 %} {% for version in revision.versions %}
<tr> <tr>
<td> <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 }} {{ version.name }}
</a> </a>
</td> </td>
<td> <td>
<a href="{% url 'users:profil' userid=revision.user.id %}" title=tr_view_the_profile> <a href="{% url 'users:profil' userid=revision.performed_by.id %}" title=tr_view_the_profile>
{{ revision.user }} {{ revision.performed_by }}
</a> </a>
</td> </td>
<td>{{ revision.date_created }}</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 ( from .models import (
ActionsSearch, ActionsSearch,
RevisionAction,
MachineHistorySearch, MachineHistorySearch,
UserHistory, UserHistory,
MachineHistory, MachineHistory,
@ -176,6 +177,7 @@ def stats_logs(request):
pagination_number = GeneralOption.get_cached_value("pagination_number") pagination_number = GeneralOption.get_cached_value("pagination_number")
revisions = re2o_paginator(request, revisions, 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/stats_logs.html", {"revisions_list": revisions})
return render(request, "logs/search_stats_logs.html", {"actions_form": actions_form}) return render(request, "logs/search_stats_logs.html", {"actions_form": actions_form})