add shortid and refactor unassigned devices table

This commit is contained in:
pedro 2024-09-26 00:22:21 -03:00
parent 59f6ac705c
commit e2f5358d83
3 changed files with 25 additions and 3 deletions

View File

@ -33,7 +33,19 @@
<thead>
<tr>
<th scope="col" data-sortable="">
<a class="dataTable-sorter" href="#">Title</a>
select
</th>
<th scope="col" data-sortable="">
shortid
</th>
<th scope="col" data-sortable="">
type
</th>
<th scope="col" data-sortable="">
manufacturer
</th>
<th scope="col" data-sortable="">
model
</th>
</tr>
</thead>
@ -45,9 +57,18 @@
</td>
<td>
<a href="{% url 'device:details' dev.id %}">
{{ dev.type }} {{ dev.manufacturer }} {{ dev.model }}
{{ dev.shortid }}
</a>
</td>
<td>
{{ dev.type }}
</td>
<td>
{{ dev.manufacturer }}
</td>
<td>
{{ dev.model }}
</td>
</tr>
</tbody>
{% endfor %}

View File

@ -27,6 +27,7 @@ class Device:
# the id is the chid of the device
self.id = kwargs["id"]
self.pk = self.id
self.shortid = self.pk[:6]
self.algorithm = None
self.owner = None
self.annotations = []

View File

@ -4,7 +4,7 @@
{% block content %}
<div class="row">
<div class="col">
<h3>{{ object.id }}</h3>
<h3>{{ object.shortid }}</h3>
</div>
</div>