refactor(DeviceListCreateAPIView): Update all_devices parameter handling for improved boolean parsing 🔨
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m30s

This commit is contained in:
2025-06-30 23:21:08 +05:00
parent 708d7c2bec
commit bae0882879

View File

@ -30,11 +30,15 @@ class DeviceListCreateAPIView(
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset()) 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 ( if (
request.user.is_authenticated request.user.is_authenticated
and getattr(request.user, "is_admin", False) and getattr(request.user, "is_admin")
and all_devices and bool(all_devices)
): ):
pass pass
else: else: