From c1bb37d23fd7376bbd5bb792385ba17f7f93ac57 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Thu, 23 Apr 2020 16:16:26 +0000 Subject: [PATCH] Fix InterfaceHistory.get --- logs/models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/logs/models.py b/logs/models.py index 0c52f885..6e520b93 100644 --- a/logs/models.py +++ b/logs/models.py @@ -457,22 +457,22 @@ class InterfaceHistoryEvent(HistoryEvent): pass -class InterfaceHistory: - def get(self, interface_id): +class InterfaceHistory(History): + def get(self, interface): """ - :param interface_id: Interface, the interface to lookup + :param interface: Interface, the interface to lookup :return: list or None, a list of InterfaceHistoryEvent, in reverse chronological order """ self.events = [] # Get all the versions for this interface, with the oldest first self._last_version = None - user_versions = filter( - lambda x: x.field_dict["id"] == interface_id, + interface_versions = filter( + lambda x: x.field_dict["id"] == interface.id, Version.objects.get_for_model(Interface).order_by("revision__date_created") ) - for version in user_versions: + for version in interface_versions: self._add_revision(version) return self.events[::-1]