Add get_serial_number method

This commit is contained in:
sergio_gimenez 2024-11-04 08:20:37 +01:00
parent e4124fb20b
commit 7db879e189
1 changed files with 11 additions and 5 deletions

View File

@ -129,7 +129,8 @@ class Device:
return self.uuids[0]
def get_lots(self):
self.lots = [x.lot for x in DeviceLot.objects.filter(device_id=self.id)]
self.lots = [
x.lot for x in DeviceLot.objects.filter(device_id=self.id)]
@classmethod
def get_unassigned(cls, institution, offset=0, limit=None):
@ -179,7 +180,6 @@ class Device:
count = cls.get_unassigned_count(institution)
return devices, count
@classmethod
def get_unassigned_count(cls, institution):
@ -279,6 +279,12 @@ class Device:
self.get_last_evidence()
return self.last_evidence.get_manufacturer()
@property
def serial_number(self):
if not self.last_evidence:
self.get_last_evidence()
return self.last_evidence.get_serial_number()
@property
def type(self):
if self.last_evidence.doc['type'] == "WebSnapshot":