add shortid and refactor unassigned devices table #5

Merged
cayop merged 1 commits from tau_shortid into tau 2024-09-26 09:58:50 +00:00
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>