fix some bugs

This commit is contained in:
Cayo Puigdefabregas 2024-10-30 16:00:23 +01:00
parent 220d718d04
commit ca0292aad9
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@
<a href="#evidences" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">{% trans 'Evidences' %}</a> <a href="#evidences" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">{% trans 'Evidences' %}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'device:device_web' object.id %}">Web</a> <a class="nav-link" href="{% url 'device:device_web' object.id %}" target="_blank">Web</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -53,10 +53,6 @@
</div> </div>
{% endif %} {% endif %}
<div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Phid</div>
<div class="col-lg-9 col-md-8">{{ object.id }}</div>
</div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Type</div> <div class="col-lg-3 col-md-4 label">Type</div>
<div class="col-lg-9 col-md-8">{{ object.type }}</div> <div class="col-lg-9 col-md-8">{{ object.type }}</div>

View File

@ -117,6 +117,10 @@ class PublicDeviceWebView(TemplateView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.pk = kwargs['pk'] self.pk = kwargs['pk']
self.object = Device(id=self.pk) self.object = Device(id=self.pk)
if not self.object.last_evidence:
raise Http404
if self.request.headers.get('Accept') == 'application/json': if self.request.headers.get('Accept') == 'application/json':
return self.get_json_response() return self.get_json_response()
return super().get(request, *args, **kwargs) return super().get(request, *args, **kwargs)