mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-28 15:53:57 +00:00
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
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m37s
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user