fixed search and moved delete user property class
This commit is contained in:
parent
caa2be3a41
commit
10f2f6dc16
|
@ -6,7 +6,7 @@ from django.shortcuts import Http404
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from dashboard.mixins import InventaryMixin, DetailsMixin
|
from dashboard.mixins import InventaryMixin, DetailsMixin
|
||||||
from evidence.models import Property
|
from evidence.models import Property, SystemProperty
|
||||||
from evidence.xapian import search
|
from evidence.xapian import search
|
||||||
from device.models import Device
|
from device.models import Device
|
||||||
from lot.models import Lot
|
from lot.models import Lot
|
||||||
|
@ -74,7 +74,7 @@ class SearchView(InventaryMixin):
|
||||||
|
|
||||||
for x in matches:
|
for x in matches:
|
||||||
# devices.append(self.get_annotations(x))
|
# devices.append(self.get_annotations(x))
|
||||||
dev = self.get_property(x)
|
dev = self.get_properties(x)
|
||||||
if dev.id not in dev_id:
|
if dev.id not in dev_id:
|
||||||
devices.append(dev)
|
devices.append(dev)
|
||||||
dev_id.append(dev.id)
|
dev_id.append(dev.id)
|
||||||
|
|
|
@ -141,31 +141,6 @@ class DownloadEvidenceView(DashboardView, TemplateView):
|
||||||
return response
|
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):
|
class EraseServerView(DashboardView, FormView):
|
||||||
|
|
Loading…
Reference in New Issue