feature/90-implement-public-website-for-device #17
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue