8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 11:53:12 +00:00

Fix dispalying related history in detailed history view

This commit is contained in:
Jean-Romain Garnier 2020-04-23 17:46:25 +00:00 committed by Gabriel Detraz
parent d6727d18e5
commit 76f93fa383
2 changed files with 7 additions and 5 deletions

View file

@ -468,7 +468,7 @@ class UserHistory(History):
lambda x: x.field_dict["user_id"] == user.id, lambda x: x.field_dict["user_id"] == user.id,
Version.objects.get_for_model(Machine).order_by("revision__date_created") Version.objects.get_for_model(Machine).order_by("revision__date_created")
) )
self.related = [RelatedHistory(m.get_name(), m) for m in self.related] self.related = [RelatedHistory(m.field_dict["name"] or _("None"), m) for m in self.related]
self.related = list(dict.fromkeys(self.related)) self.related = list(dict.fromkeys(self.related))
# Get all the versions for this user, with the oldest first # Get all the versions for this user, with the oldest first
@ -554,7 +554,7 @@ class MachineHistory(History):
)) ))
# Create RelatedHistory objects and remove duplicates # Create RelatedHistory objects and remove duplicates
self.related = [RelatedHistory(i.mac_address, i) for i in self.related] self.related = [RelatedHistory(i.field_dict["mac_address"], i) for i in self.related]
self.related = list(dict.fromkeys(self.related)) self.related = list(dict.fromkeys(self.related))
return super(MachineHistory, self).get(machine) return super(MachineHistory, self).get(machine)

View file

@ -1,3 +1,4 @@
{% extends 'logs/sidebar.html' %}
{% comment %} {% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en se veut agnostique au réseau considéré, de manière à être installable en
@ -22,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %} {% load bootstrap3 %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
{% block title %}{% trans "History" %}{% endblock %} {% block title %}{% trans "History" %}{% endblock %}
@ -73,20 +75,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h3>{% trans "No event" %}</h3> <h3>{% trans "No event" %}</h3>
{% endif %} {% endif %}
<h2>{% trans Related history %}</h2> <h2>{% trans "Related history" %}</h2>
{% if related_history %} {% if related_history %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Actions" %}</th> <th>{% trans "Actions" %}</th>
<th>{% trans "ID" %}</th>
</tr> </tr>
</thead> </thead>
{% for related in related_history %} {% for related in related_history %}
<tr> <tr>
<td>{% history_button related.instance detailed=related.detailed %}</td>
<td>{{ related.name }}</td> <td>{{ related.name }}</td>
<td>{% history_button related.instance text=True detailed=related.detailed %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>