Add is_admin field to User model and update related serializers and views
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m37s

This commit is contained in:
2025-06-09 13:28:57 +05:00
parent 7e2f6699b1
commit 69ab87f502
6 changed files with 24 additions and 2 deletions

View File

@ -30,7 +30,9 @@ class DeviceListCreateAPIView(
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
if not request.user.is_superuser:
if request.user.is_authenticated and not getattr(
request.user, "is_admin", False
):
queryset = queryset.filter(user=request.user)
page = self.paginate_queryset(queryset)