I am trying to use permission required decorator using authorization 
header.And it always gives me 302 error. although my user has permission 
for it.Kindly help I am beginner to django.
Here is my code

@permission_required('access_admin', login_url=None)
@permission_classes((IsAuthenticated,))
@api_view(['POST','GET'])
def actionLibrary(request):
    if request.method == 'GET':
        print(request.user.has_perm("api.access_admin")) #it print true if 
I remove permission_required decorator
        queryset=ActionLibrary.objects.all()
        serializer=ActionLibrarySerailizer(queryset,many=True)
        return Response(serializer.data)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7952f118-107c-489b-a9e0-a94cc3441337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to