diff --git a/dashboard/mixins.py b/dashboard/mixins.py
index a6c372c..c28dcf8 100644
--- a/dashboard/mixins.py
+++ b/dashboard/mixins.py
@@ -5,6 +5,8 @@ from django.core.exceptions import PermissionDenied
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.base import TemplateView
from device.models import Device
+from evidence.models import Annotation
+from lot.models import LotTag
class Http403(PermissionDenied):
@@ -37,13 +39,17 @@ class DashboardView(LoginRequiredMixin):
'section': self.section,
'path': resolve(self.request.path).url_name,
'user': self.request.user,
+ 'lot_tags': LotTag.objects.filter(owner=self.request.user)
})
return context
def get_session_devices(self):
# import pdb; pdb.set_trace()
dev_ids = self.request.session.pop("devices", [])
- self._devices = Device.objects.filter(id__in=dev_ids).filter(owner=self.request.user)
+
+ self._devices = []
+ for x in Annotation.objects.filter(value__in=dev_ids).filter(owner=self.request.user).distinct():
+ self._devices.append(Device(id=x.value))
return self._devices
@@ -51,7 +57,7 @@ class DetailsMixin(DashboardView, TemplateView):
def get(self, request, *args, **kwargs):
self.pk = kwargs['pk']
- self.object = get_object_or_404(self.model, pk=self.pk)
+ self.object = get_object_or_404(self.model, pk=self.pk, owner=self.request.user)
return super().get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
@@ -61,7 +67,7 @@ class DetailsMixin(DashboardView, TemplateView):
})
return context
-
+
class InventaryMixin(DashboardView, TemplateView):
def post(self, request, *args, **kwargs):
@@ -76,5 +82,3 @@ class InventaryMixin(DashboardView, TemplateView):
except Exception:
pass
return super().get(request, *args, **kwargs)
-
-
diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html
index 8134c90..67c7573 100644
--- a/dashboard/templates/base.html
+++ b/dashboard/templates/base.html
@@ -59,7 +59,7 @@