Last active
March 21, 2021 01:06
-
-
Save sankalpjonn/1ac4b2109b17911330b4242220bc906c 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.views import APIView | |
| from .custom_permissions import IsAdmin, IsEditor, IsUser | |
| # only admins are allowed to access this view | |
| class APIView1(APIView): | |
| permission_classes = (IsAdmin,) | |
| # Admins or editors are allowed to access this view | |
| class APIView2(APIView): | |
| permission_classes = (IsAdmin | IsEditor,) | |
| # all types of users are allowed to access this view | |
| class APIView3(APIView): | |
| permission_classes = (IsAdmin | IsEditor | IsUser,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment