Sample class for CSRF disable
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
class CsrfExemptSessionAuthentication(SessionAuthentication):
def enforce_csrf(self, request):
return # To not perform the csrf check previously happening
In view add
class MyTableDetailApiView(generics.RetrieveUpdateDestroyAPIView):
queryset = MyTable.objects.all()
serializer_class = MyTableSerializer
authentication_classes = (CsrfExemptSessionAuthentication, BasicAuthentication)
Posted by Cuauhtemoc to Python Django (2018-10-01 15:23)