diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index c0876598..9cf2ce54 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -475,6 +475,12 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): # todo will this url_for_resource work for other resources? return urlutils.URL(url_for_resource('Document', item_id=self.id)) + def get_phid(self): + if self.device and self.device.parent: + if hasattr(self.device.parent, 'phid'): + return self.device.parent.phid() + return '' + def __str__(self) -> str: return '{} on {}.'.format(self.severity, self.date_str) diff --git a/ereuse_devicehub/templates/inventory/erasure_list.html b/ereuse_devicehub/templates/inventory/erasure_list.html index 555b29e0..6495d2d6 100644 --- a/ereuse_devicehub/templates/inventory/erasure_list.html +++ b/ereuse_devicehub/templates/inventory/erasure_list.html @@ -84,7 +84,7 @@ - {{ ac.device.parent.phid() }} + {{ ac.get_phid() }}