add verbose_name in device.model instead of use template system
This commit is contained in:
parent
075135c191
commit
b737aaf50a
|
@ -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.
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Reference in a new issue