add verbose_name in device.model instead of use template system

This commit is contained in:
Cayo Puigdefabregas 2022-03-04 13:31:33 +01:00
parent 075135c191
commit b737aaf50a
4 changed files with 10 additions and 3 deletions

View file

@ -474,6 +474,13 @@ class Device(Thing):
key=attrgetter('type')) # last test of each type
return self._warning_actions(current_tests)
@property
def verbose_name(self):
type = self.type or ''
manufacturer = self.manufacturer or ''
model = self.model or ''
return f'{type} {manufacturer} {model}'
@declared_attr
def __mapper_args__(cls):
"""Defines inheritance.

View file

@ -316,7 +316,7 @@
</td>
<td>
<a href="{{ url_for('inventory.devices.device_details', id=dev.devicehub_id)}}">
{{ dev.type }} {{ dev.manufacturer|d('', true) }} {{ dev.model|d('', true) }}
{{ dev.verbose_name }}
</a>
</td>
<td>

View file

@ -34,7 +34,7 @@
<div class="col-lg-9 col-md-8">
{% if tag.device %}
<a href="{{url_for('inventory.devices.device_details', id=tag.device.devicehub_id)}}">
{{ tag.device.type }} {{ tag.device.manufacturer|d('', true) }} {{ tag.device.model|d('', true) }}
{{ tag.device.verbose_name }}
</a>
{% endif %}
</div>

View file

@ -58,7 +58,7 @@
<td>
{% if tag.device %}
<a href={{ url_for('inventory.devices.device_details', id=tag.device.devicehub_id)}}>
{{ tag.device.type }} {{ tag.device.manufacturer|d('', true) }} {{ tag.device.model|d('', true) }}
{{ tag.device.verbose_name }}
</a>
{% endif %}
</td>