get the last update of one device
This commit is contained in:
parent
b1736f68af
commit
c3aa1edd5a
|
@ -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.
|
||||
|
|
|
@ -437,7 +437,7 @@
|
|||
<td>{% if dev.status %}{{ dev.status.type }}{% endif %}</td>
|
||||
<td>{% if dev.allocated_status %}{{ dev.allocated_status.type }}{% endif %}</td>
|
||||
<td>{% if dev.physical_status %}{{ dev.physical_status.type }}{% endif %}</td>
|
||||
<td>{{ dev.updated.strftime('%Y-%m-%d %H:%M:%S')}}</td>
|
||||
<td>{{ dev.get_updated.strftime('%Y-%m-%d %H:%M:%S')}}</td>
|
||||
<td>{{ dev.created.strftime('%Y-%m-%d %H:%M:%S')}}</td>
|
||||
<td>
|
||||
<a href="{{ dev.public_link }}" target="_blank">
|
||||
|
|
Reference in New Issue