From 20de54337e66698dcae511cd1568afd3b38b5365 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 31 Jul 2024 13:21:54 +0200 Subject: [PATCH] fix view lots in details of device --- device/models.py | 5 +++++ device/templates/details.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/device/models.py b/device/models.py index aa0b95f..ce874fd 100644 --- a/device/models.py +++ b/device/models.py @@ -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() diff --git a/device/templates/details.html b/device/templates/details.html index 38e1d78..a549910 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -121,7 +121,7 @@ {% for tag in lot_tags %}
{{ tag }}
- {% for lot in tag.lot_set.filter %} + {% for lot in object.lots %} {% if lot.type == tag %}