mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22: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.app_name = version.content_type.app_label
|
||||||
self.model_name = version.content_type.model
|
self.model_name = version.content_type.model
|
||||||
self.object_id = version.object_id
|
self.object_id = version.object_id
|
||||||
self.name = version._object_cache or version.object_repr
|
self.name = version.object_repr
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (
|
return (
|
||||||
|
@ -390,6 +390,7 @@ class History:
|
||||||
if self._last_version is None:
|
if self._last_version is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
self.name = self._last_version.object_repr
|
||||||
return self.events[::-1]
|
return self.events[::-1]
|
||||||
|
|
||||||
def _compute_diff(self, v1, v2, ignoring=[]):
|
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 = [RelatedHistory(v) for v in self.related]
|
||||||
self.related = list(dict.fromkeys(self.related))
|
self.related = list(dict.fromkeys(self.related))
|
||||||
|
|
||||||
events = super(MachineHistory, self).get(machine_id, Machine)
|
return super(MachineHistory, self).get(machine_id, Machine)
|
||||||
|
|
||||||
# Update name
|
|
||||||
self.name = self._last_version.field_dict["name"]
|
|
||||||
|
|
||||||
return events
|
|
||||||
|
|
||||||
|
|
||||||
class InterfaceHistoryEvent(HistoryEvent):
|
class InterfaceHistoryEvent(HistoryEvent):
|
||||||
|
@ -794,12 +790,7 @@ class InterfaceHistory(History):
|
||||||
self.event_type = InterfaceHistoryEvent
|
self.event_type = InterfaceHistoryEvent
|
||||||
|
|
||||||
def get(self, interface_id, model):
|
def get(self, interface_id, model):
|
||||||
events = super(InterfaceHistory, self).get(interface_id, Interface)
|
return super(InterfaceHistory, self).get(interface_id, Interface)
|
||||||
|
|
||||||
# Update name
|
|
||||||
self.name = self._last_version.field_dict["mac_address"]
|
|
||||||
|
|
||||||
return events
|
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
|
|
|
@ -79,7 +79,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% for related in related_history %}
|
{% for related in related_history %}
|
||||||
<li>
|
<li>
|
||||||
{% if related.object_id %}
|
{% 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 }}
|
{{ related.name }}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue