SHARE
TWEET

Untitled

a guest Nov 9th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from rest_framework import generics
  2. from rest_framework.permissions import IsAdminUser
  3.  
  4.  
  5. class UserList(generics.ListCreateAPIView):
  6.     queryset = User.objects.all()
  7.     serializer_class = UserSerializer
  8.     permission_classes = [IsAdminUser]
  9.  
  10.  
  11. class ExampleView(APIView) :
  12.     permission_classes = [IsAuthenticated|ReadOnly]
  13.    
  14.     def get(self, request, format=None):
  15.         content = {
  16.             'status':'request was permitted'
  17.         }
  18.        
  19.         return Response(content)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top