add evidences in details of device
This commit is contained in:
parent
6494e2bedc
commit
468abb2c2f
|
@ -125,6 +125,18 @@ class Device:
|
|||
# owner=user
|
||||
# ).annotate(num_lots=models.Count('lot')).filter(num_lots=0)
|
||||
|
||||
@property
|
||||
def is_websnapshot(self):
|
||||
if not self.last_evidence:
|
||||
self.get_last_evidence()
|
||||
return self.last_evidence.doc['type'] == "WebSnapshot"
|
||||
|
||||
@property
|
||||
def last_user_evidence(self):
|
||||
if not self.last_evidence:
|
||||
self.get_last_evidence()
|
||||
return self.last_evidence.doc['kv'].items()
|
||||
|
||||
@property
|
||||
def manufacturer(self):
|
||||
if not self.last_evidence:
|
||||
|
|
|
@ -49,6 +49,14 @@
|
|||
<div class="col-lg-9 col-md-8">{{ object.type }}</div>
|
||||
</div>
|
||||
|
||||
{% if object.is_websnapshot %}
|
||||
{% for k, v in object.last_user_evidence %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">{{ k }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ v|default:"" }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Manufacturer</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:"" }}</div>
|
||||
|
@ -63,6 +71,7 @@
|
|||
<div class="col-lg-3 col-md-4 label">Serial Number</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:"" }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Identifiers</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue