diff --git a/devices/views.py b/devices/views.py index bf9f4cb..c5e3add 100644 --- a/devices/views.py +++ b/devices/views.py @@ -30,11 +30,15 @@ class DeviceListCreateAPIView( def list(self, request, *args, **kwargs): queryset = self.filter_queryset(self.get_queryset()) - all_devices = request.query_params.get("all_devices", None) + all_devices = request.query_params.get("all_devices", "false").lower() in [ + "true", + "1", + "yes", + ] if ( request.user.is_authenticated - and getattr(request.user, "is_admin", False) - and all_devices + and getattr(request.user, "is_admin") + and bool(all_devices) ): pass else: