How to set multiple permissions in one class view, depending on http request
Posted
by
andrew13331
on Stack Overflow
See other posts from Stack Overflow
or by andrew13331
Published on 2014-06-04T15:22:00Z
Indexed on
2014/06/04
15:24 UTC
Read the original article
Hit count: 356
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,)
© Stack Overflow or respective owner