all devices

This commit is contained in:
Cayo Puigdefabregas 2024-07-10 16:15:37 +02:00
parent d687c96112
commit 72f242ad88
3 changed files with 17 additions and 1 deletions

View File

@ -91,7 +91,7 @@
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link{% if path == 'admin_people_new' %} active2{% endif %}" href="{# url 'idhub:admin_people_new' #}"> <a class="nav-link{% if path == 'admin_people_new' %} active2{% endif %}" href="{% url 'dashboard:all_devices' %}">
{% trans 'All devices' %} {% trans 'All devices' %}
</a> </a>
</li> </li>

View File

@ -5,5 +5,6 @@ app_name = 'dashboard'
urlpatterns = [ urlpatterns = [
path("", views.UnassignedDevicesView.as_view(), name="unassigned_devices"), path("", views.UnassignedDevicesView.as_view(), name="unassigned_devices"),
path("all/", views.AllDevicesView.as_view(), name="all_devices"),
path("<int:pk>/", views.LotDashboardView.as_view(), name="lot"), path("<int:pk>/", views.LotDashboardView.as_view(), name="lot"),
] ]

View File

@ -22,6 +22,21 @@ class UnassignedDevicesView(InventaryMixin):
return context 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): class LotDashboardView(InventaryMixin, DetailsMixin):
template_name = "unassigned_devices.html" template_name = "unassigned_devices.html"
section = "Unassigned" section = "Unassigned"