devicehub-django/dashboard/views.py

20 lines
651 B
Python

from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
from dashboard.mixins import DashboardView
from device.models import Device
class UnassignedDevicesView(DashboardView, TemplateView):
template_name = "unassigned_devices.html"
section = "Unassigned"
title = _("Unassigned Devices")
breadcrumb = "Devices / Unassigned 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