diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index b55d9eb7..5a40cfc6 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -629,6 +629,14 @@ class Device(Thing): return self.binding.device.devicehub_id return self.devicehub_id + @property + def get_updated(self): + if self.placeholder and self.placeholder.binding: + return max([self.updated, self.placeholder.binding.updated]) + if self.binding: + return max([self.updated, self.binding.device.updated]) + return self.updated + @declared_attr def __mapper_args__(cls): """Defines inheritance. diff --git a/ereuse_devicehub/templates/inventory/device_list.html b/ereuse_devicehub/templates/inventory/device_list.html index 6d0f1ad7..1d4e00f1 100644 --- a/ereuse_devicehub/templates/inventory/device_list.html +++ b/ereuse_devicehub/templates/inventory/device_list.html @@ -437,7 +437,7 @@ {% if dev.status %}{{ dev.status.type }}{% endif %} {% if dev.allocated_status %}{{ dev.allocated_status.type }}{% endif %} {% if dev.physical_status %}{{ dev.physical_status.type }}{% endif %} - {{ dev.updated.strftime('%Y-%m-%d %H:%M:%S')}} + {{ dev.get_updated.strftime('%Y-%m-%d %H:%M:%S')}} {{ dev.created.strftime('%Y-%m-%d %H:%M:%S')}}