How to set multiple permissions in one class view, depending on http request
- by andrew13331
How can I change the permissions depending on if it is a get or a post. Is it possible to do it in one class or would I have to separate it out into two classes? If its a get I want "permission_classes = (permissions.IsAuthenticated)" and if its a post I want "permission_classes = (permissions.IsAdminUser)"
class CategoryList(generics.ListCreateAPIView):
queryset = QuestionCategory.objects.all()
serializer_class = QuestionCategorySerializer
permission_classes = (permissions.IsAuthenticated,)