8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 01:13:46 +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 Supelec Rezo Rennes
parent 063e6b48bd
commit 6c3d6082b1
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,
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))
# Get all the versions for this user, with the oldest first
@ -554,7 +554,7 @@ class MachineHistory(History):
))
# 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))
return super(MachineHistory, self).get(machine)

View file

@ -1,3 +1,4 @@
{% extends 'logs/sidebar.html' %}
{% comment %}
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
@ -22,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %}
{% load i18n %}
{% load logs_extra %}
{% 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>
{% endif %}
<h2>{% trans Related history %}</h2>
<h2>{% trans "Related history" %}</h2>
{% if related_history %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Actions" %}</th>
<th>{% trans "ID" %}</th>
</tr>
</thead>
{% for related in related_history %}
<tr>
<td>{% history_button related.instance detailed=related.detailed %}</td>
<td>{{ related.name }}</td>
<td>{% history_button related.instance text=True detailed=related.detailed %}</td>
</tr>
{% endfor %}
</table>