devicehub-django/dashboard/views.py

20 lines
639 B
Python
Raw Normal View History

2024-07-01 10:19:21 +00:00
from django.utils.translation import gettext_lazy as _
2024-07-05 13:32:07 +00:00
from django.views.generic.base import TemplateView
2024-07-09 11:34:30 +00:00
from dashboard.mixins import InventaryMixin
2024-07-05 13:32:07 +00:00
from device.models import Device
2024-07-01 10:19:21 +00:00
2024-07-09 11:34:30 +00:00
class UnassignedDevicesView(InventaryMixin):
2024-07-05 13:32:07 +00:00
template_name = "unassigned_devices.html"
section = "Unassigned"
title = _("Unassigned Devices")
breadcrumb = "Devices / Unassigned Devices"
2024-07-01 10:19:21 +00:00
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
2024-07-05 13:32:07 +00:00
devices = Device.objects.filter(owner=self.request.user)
2024-07-01 10:19:21 +00:00
context.update({
2024-07-05 13:32:07 +00:00
'devices': devices,
2024-07-01 10:19:21 +00:00
})
return context