You need to wrap the dispatch method of ModelViewSet with csrf_exempt :
from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt class MyModelViewSet(viewsets.ModelViewSet): @method_decorator(csrf_exempt) def dispatch(self, *args, **kwargs): return super(MyModelViewSet, self).dispatch(*args, **kwargs)
or you can achieve the same effect by wrapping the view in urls.py :
url(r'^snippets/$', csrf_exempt(snippet_list), name='snippet-list'), url(r'^snippets/(?P<pk>[0-9]+)/$', csrf_exempt(snippet_detail), name='snippet-detail'),
mariodev
source share