Or look into a custom permission: https://www.django-rest-framework.org/api-guide/permissions/#custom-permissions
IsCreationOrAuthenticated like the: IsOwnerOrReadonly Instead of the request.method in permissions.SAFE_METHODS, see if the method == "POST" On Tue, Sep 10, 2019 at 2:30 PM siva gatti <siva.ga...@gmail.com> wrote: > class UserViewSet(viewsets.ModelViewSet): > permission_classes =[IsAuthenticated] > if(permission_classes): > http_method_names = ['post'] > queryset = Documents.objects.all() > serializer_class = DocumentSerializer > i am trying like this > my problem is unauth users can only access post method and auth users can > access post,get,put methods > > On Tue, Sep 10, 2019 at 5:47 PM siva gatti <siva.ga...@gmail.com> wrote: > >> unauthenticated users can only post but here they can do get ,delete and >> update >> >> On Tue, Sep 10, 2019 at 5:34 PM Harrys Asimakopoulos <xarhs...@gmail.com> >> wrote: >> >>> from rest_framework.permissions import AllowAny >>> >>> class UserViewSet(viewsets.ModelViewSet): >>> permission_classes = [AllowAny,] >>> queryset = Documents.objects.all() >>> serializer_class = DocumentSerializer >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django REST framework" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-rest-framework+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-rest-framework/f9f13934-f4b1-4bf7-a675-fc606cf21908%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-rest-framework/f9f13934-f4b1-4bf7-a675-fc606cf21908%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "Django REST framework" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-rest-framework+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-rest-framework/CAA9F9ijJTZgogDyg3ufKw%2Bm5sXuHpRFREfrdYyNKHmk%3D%3DnC_hg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-rest-framework/CAA9F9ijJTZgogDyg3ufKw%2Bm5sXuHpRFREfrdYyNKHmk%3D%3DnC_hg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Jakob Damgaard Olsen Tlf: 24613112 -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAMmJSsHtbaiwAprJvD%2BOmNykXo6cE5o1%3DjCbx2Q1CRYF-0DKSA%40mail.gmail.com.