Django: csrf_exempt of class based view

To suppress csrf verification of class based view, @csrf_exempt decorator in doesn’t work in Django 1.4 .

Instead, decorating the as_view function in works fine!

from django.views.decorators.csrf import csrf_exempt

urlpatterns = patterns('',
       url(r'^$', csrf_exempt(views.IndexView.as_view()), name='index'),


Leave a Reply

Your email address will not be published. Required fields are marked *