Merge pull request 'add shortid and refactor unassigned devices table' (#5) from tau_shortid into tau

Reviewed-on: #5
This commit is contained in:
cayop 2024-09-26 09:58:49 +00:00
commit 76457893f5
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>