mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Improve display of deleted objects in history
This commit is contained in:
parent
1b6bf87dbc
commit
60a8fd0ed5
2 changed files with 5 additions and 14 deletions
|
@ -299,7 +299,7 @@ class RelatedHistory:
|
|||
self.app_name = version.content_type.app_label
|
||||
self.model_name = version.content_type.model
|
||||
self.object_id = version.object_id
|
||||
self.name = version._object_cache or version.object_repr
|
||||
self.name = version.object_repr
|
||||
|
||||
def __eq__(self, other):
|
||||
return (
|
||||
|
@ -390,6 +390,7 @@ class History:
|
|||
if self._last_version is None:
|
||||
return None
|
||||
|
||||
self.name = self._last_version.object_repr
|
||||
return self.events[::-1]
|
||||
|
||||
def _compute_diff(self, v1, v2, ignoring=[]):
|
||||
|
@ -743,12 +744,7 @@ class MachineHistory(History):
|
|||
self.related = [RelatedHistory(v) for v in self.related]
|
||||
self.related = list(dict.fromkeys(self.related))
|
||||
|
||||
events = super(MachineHistory, self).get(machine_id, Machine)
|
||||
|
||||
# Update name
|
||||
self.name = self._last_version.field_dict["name"]
|
||||
|
||||
return events
|
||||
return super(MachineHistory, self).get(machine_id, Machine)
|
||||
|
||||
|
||||
class InterfaceHistoryEvent(HistoryEvent):
|
||||
|
@ -794,12 +790,7 @@ class InterfaceHistory(History):
|
|||
self.event_type = InterfaceHistoryEvent
|
||||
|
||||
def get(self, interface_id, model):
|
||||
events = super(InterfaceHistory, self).get(interface_id, Interface)
|
||||
|
||||
# Update name
|
||||
self.name = self._last_version.field_dict["mac_address"]
|
||||
|
||||
return events
|
||||
return super(InterfaceHistory, self).get(interface_id, Interface)
|
||||
|
||||
|
||||
############################
|
||||
|
|
|
@ -79,7 +79,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% for related in related_history %}
|
||||
<li>
|
||||
{% if related.object_id %}
|
||||
<a href="{% url 'logs:history' related.application related.model_name related.object_id %}" title="{% trans "History" %}">
|
||||
<a href="{% url 'logs:history' related.app_name related.model_name related.object_id %}" title="{% trans "History" %}">
|
||||
{{ related.name }}
|
||||
</a>
|
||||
{% else %}
|
||||
|
|
Loading…
Reference in a new issue