diff --git a/device/views.py b/device/views.py index 6e305f8..14381e8 100644 --- a/device/views.py +++ b/device/views.py @@ -110,7 +110,7 @@ class DetailsView(DashboardView, TemplateView): return context -class DeviceWebView(TemplateView): +class PublicDeviceWebView(TemplateView): template_name = "device_web.html" def get(self, request, *args, **kwargs): @@ -132,17 +132,19 @@ class DeviceWebView(TemplateView): def get_json_response(self): 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(), } return JsonResponse(data) def get_object_data(self): + serial_number = self.object.last_evidence.doc.device.serialNumber if self.object.last_evidence else "None" object_data = { 'phid': self.object.id, 'type': self.object.type, 'manufacturer': self.object.manufacturer, 'model': self.object.model, - # 'serial_number': object.last_evidence.doc.device.serialNumber, + 'serial_number': serial_number, } return object_data