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
|
key=attrgetter('type')) # last test of each type
|
||||||
return self._warning_actions(current_tests)
|
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
|
@declared_attr
|
||||||
def __mapper_args__(cls):
|
def __mapper_args__(cls):
|
||||||
"""Defines inheritance.
|
"""Defines inheritance.
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('inventory.devices.device_details', id=dev.devicehub_id)}}">
|
<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>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="col-lg-9 col-md-8">
|
<div class="col-lg-9 col-md-8">
|
||||||
{% if tag.device %}
|
{% if tag.device %}
|
||||||
<a href="{{url_for('inventory.devices.device_details', id=tag.device.devicehub_id)}}">
|
<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>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<td>
|
<td>
|
||||||
{% if tag.device %}
|
{% if tag.device %}
|
||||||
<a href={{ url_for('inventory.devices.device_details', id=tag.device.devicehub_id)}}>
|
<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>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
Reference in New Issue