Skip to content

Instantly share code, notes, and snippets.

@sankalpjonn
Last active March 26, 2019 08:19
Show Gist options
  • Save sankalpjonn/f53d8b070c150bfcc397d94f864ef53b to your computer and use it in GitHub Desktop.
Save sankalpjonn/f53d8b070c150bfcc397d94f864ef53b to your computer and use it in GitHub Desktop.
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