From 10f2f6dc16daa62efbfe0e5a971c48140851bf8a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Thu, 14 Nov 2024 14:16:45 -0300 Subject: [PATCH] fixed search and moved delete user property class --- dashboard/views.py | 4 ++-- evidence/views.py | 25 ------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/dashboard/views.py b/dashboard/views.py index 2cf0a62..cb36078 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -6,7 +6,7 @@ from django.shortcuts import Http404 from django.db.models import Q from dashboard.mixins import InventaryMixin, DetailsMixin -from evidence.models import Property +from evidence.models import Property, SystemProperty from evidence.xapian import search from device.models import Device from lot.models import Lot @@ -74,7 +74,7 @@ class SearchView(InventaryMixin): for x in matches: # devices.append(self.get_annotations(x)) - dev = self.get_property(x) + dev = self.get_properties(x) if dev.id not in dev_id: devices.append(dev) dev_id.append(dev.id) diff --git a/evidence/views.py b/evidence/views.py index 39b8d8e..c71ab68 100644 --- a/evidence/views.py +++ b/evidence/views.py @@ -141,31 +141,6 @@ class DownloadEvidenceView(DashboardView, TemplateView): return response -class UserPropertyDeleteView(DashboardView, DeleteView): - model = UserProperty - - def get(self, request, *args, **kwargs): - self.pk = kwargs['pk'] - - try: - referer = self.request.META["HTTP_REFERER"] - path_referer = urlparse(referer).path - resolver_match = resolve(path_referer) - url_name = resolver_match.view_name - kwargs_view = resolver_match.kwargs - except: - # if is not possible resolve the reference path return 404 - raise Http404 - - self.object = get_object_or_404( - self.model, - pk=self.pk, - owner=self.request.user.institution - ) - self.object.delete() - - - return redirect(url_name, **kwargs_view) class EraseServerView(DashboardView, FormView):