From 72f242ad88bfd67bdc00d55f05d5fb3e6717bc47 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 10 Jul 2024 16:15:37 +0200 Subject: [PATCH] all devices --- dashboard/templates/base.html | 2 +- dashboard/urls.py | 1 + dashboard/views.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 3034b2e..359130a 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -91,7 +91,7 @@ diff --git a/dashboard/urls.py b/dashboard/urls.py index 681b73e..78aadfa 100644 --- a/dashboard/urls.py +++ b/dashboard/urls.py @@ -5,5 +5,6 @@ app_name = 'dashboard' urlpatterns = [ path("", views.UnassignedDevicesView.as_view(), name="unassigned_devices"), + path("all/", views.AllDevicesView.as_view(), name="all_devices"), path("/", views.LotDashboardView.as_view(), name="lot"), ] diff --git a/dashboard/views.py b/dashboard/views.py index b38628b..16c34b1 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -22,6 +22,21 @@ class UnassignedDevicesView(InventaryMixin): return context +class AllDevicesView(InventaryMixin): + template_name = "unassigned_devices.html" + section = "All" + title = _("All Devices") + breadcrumb = "Devices / All Devices" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + devices = Device.objects.filter(owner=self.request.user) + context.update({ + 'devices': devices, + }) + return context + + class LotDashboardView(InventaryMixin, DetailsMixin): template_name = "unassigned_devices.html" section = "Unassigned"