"CSRF token missing" with PUT/DELETE meethod rest-framework
<p>I'm using using django rest framework browsable api with ModelViewSet to do CRUD actions and want to use permissions.IsAuthenticatedOrReadOnly, but when I'm logged and try to DELETE or PUT I get
<code>"detail": "CSRF Failed: CSRF token missing or incorrect."</code></p>

<p>My view looks like this</p>

<pre><code>class objViewSet(viewsets.ModelViewSet):
    queryset = obj.objects.all()
    serializer_class = objSerializer
    permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
</code></pre>

<p>Settings.py</p>

<pre><code>REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
    'rest_framework.permissions.AllowAny',
),
</code></pre>

<p>Serializer is just</p>

<pre><code>class ObjSerializer(serializers.ModelSerializer):
    class Meta:
        model = Obj
</code></pre>

<p>Although when I delete permission_classes (so the default allowAny triggers) I can it works just fine.</p>

<p><strong>What I want</strong></p>

<p>To be able to PUT/DELETE only when I'm authenticated. I don't know how to send CSRF token, when all happens automatically (modalviewset does the whole work)</p>

<p>You can remove CSRF check on individual urls. Try this on your urls.py:</p>

<pre><code>url(r'^/my_url_to_view/', csrf_exempt(views.my_view_function), name='my_name'),
</code></pre>

python django rest