fix view lots in details of device

This commit is contained in:
Cayo Puigdefabregas 2024-07-31 13:21:54 +02:00
parent 4df2efd8ad
commit 9d42c27bd4
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class Device:
self.hids = []
self.uuids = []
self.evidences = []
self.lots = []
self.last_evidence = None
self.get_last_evidence()
@ -41,6 +42,7 @@ class Device:
self.get_uuids()
self.get_hids()
self.get_evidences()
self.get_lots()
def get_annotations(self):
if self.annotations:
@ -107,6 +109,9 @@ class Device:
def last_uuid(self):
return self.uuids[0]
def get_lots(self):
self.lots = [x.lot for x in DeviceLot.objects.filter(device_id=self.id)]
@classmethod
def get_unassigned(cls, user):
chids = DeviceLot.objects.filter(lot__owner=user).values_list("device_id", flat=True).distinct()

View File

@ -121,7 +121,7 @@
{% for tag in lot_tags %}
<h5 class="card-title">{{ tag }}</h5>
{% for lot in tag.lot_set.filter %}
{% for lot in object.lots %}
{% if lot.type == tag %}
<div class="row">
<div class="col">