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> <thead>
<tr> <tr>
<th scope="col" data-sortable=""> <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> </th>
</tr> </tr>
</thead> </thead>
@ -45,9 +57,18 @@
</td> </td>
<td> <td>
<a href="{% url 'device:details' dev.id %}"> <a href="{% url 'device:details' dev.id %}">
{{ dev.type }} {{ dev.manufacturer }} {{ dev.model }} {{ dev.shortid }}
</a> </a>
</td> </td>
<td>
{{ dev.type }}
</td>
<td>
{{ dev.manufacturer }}
</td>
<td>
{{ dev.model }}
</td>
</tr> </tr>
</tbody> </tbody>
{% endfor %} {% endfor %}

View File

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

View File

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