Last active
March 26, 2019 08:19
-
-
Save sankalpjonn/f53d8b070c150bfcc397d94f864ef53b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.permissions import BasePermission | |
from rest_framework.view import APIView | |
class IsStaff(BasePermission): | |
def has_permission(self, request, view): | |
return request.user and request.user.is_staff | |
class TestAPIView(APIView): | |
permission_classes = [IsStaff] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment