feature/90-implement-public-website-for-device #17
|
@ -110,7 +110,7 @@ class DetailsView(DashboardView, TemplateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class DeviceWebView(TemplateView):
|
class PublicDeviceWebView(TemplateView):
|
||||||
template_name = "device_web.html"
|
template_name = "device_web.html"
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
@ -132,17 +132,19 @@ class DeviceWebView(TemplateView):
|
||||||
def get_json_response(self):
|
def get_json_response(self):
|
||||||
data = {
|
data = {
|
||||||
'object': self.get_object_data(),
|
'object': self.get_object_data(),
|
||||||
|
# TODO i) agree on what fields to return. ii) implement get_components_data for new and old snapshot
|
||||||
# 'components': self.get_components_data(),
|
# 'components': self.get_components_data(),
|
||||||
}
|
}
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
def get_object_data(self):
|
def get_object_data(self):
|
||||||
|
serial_number = self.object.last_evidence.doc.device.serialNumber if self.object.last_evidence else "None"
|
||||||
object_data = {
|
object_data = {
|
||||||
'phid': self.object.id,
|
'phid': self.object.id,
|
||||||
'type': self.object.type,
|
'type': self.object.type,
|
||||||
'manufacturer': self.object.manufacturer,
|
'manufacturer': self.object.manufacturer,
|
||||||
'model': self.object.model,
|
'model': self.object.model,
|
||||||
# 'serial_number': object.last_evidence.doc.device.serialNumber,
|
'serial_number': serial_number,
|
||||||
}
|
}
|
||||||
return object_data
|
return object_data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue