From b2cda37dd03f5c5c553370c9166319769dc4d133 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 28 Oct 2024 17:52:34 +0100 Subject: [PATCH] add erase server definition --- device/models.py | 16 +++++ device/templates/details.html | 27 +++++--- evidence/forms.py | 53 ++++++++++++++++ .../migrations/0002_alter_annotation_type.py | 25 ++++++++ evidence/models.py | 1 + evidence/templates/ev_details.html | 32 ++++++++-- evidence/urls.py | 1 + evidence/views.py | 61 ++++++++++++++++--- lot/migrations/0002_alter_lot_closed.py | 18 ++++++ 9 files changed, 210 insertions(+), 24 deletions(-) create mode 100644 evidence/migrations/0002_alter_annotation_type.py create mode 100644 lot/migrations/0002_alter_lot_closed.py diff --git a/device/models.py b/device/models.py index da53de8..a351a11 100644 --- a/device/models.py +++ b/device/models.py @@ -108,6 +108,22 @@ class Device: return annotation = annotations.first() self.last_evidence = Evidence(annotation.uuid) + + def is_eraseserver(self): + if not self.uuids: + self.get_uuids() + if not self.uuids: + return False + + annotation = Annotation.objects.filter( + uuid__in=self.uuids, + owner=self.owner, + type=Annotation.Type.ERASE_SERVER + ).first() + + if annotation: + return True + return False def last_uuid(self): return self.uuids[0] diff --git a/device/templates/details.html b/device/templates/details.html index 51e97f1..d0e9c02 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -12,22 +12,22 @@