Commits

Jason Christa committed 000e6aa

add csrf exempt mixin

  • Participants
  • Parent commits bcfd61a

Comments (0)

Files changed (2)

File viewclass_mixins/__init__.py

 __version_info__ = {
-    'major': 0,
-    'minor': 5,
+    'major': 1,
+    'minor': 0,
     'micro': 0,
-    'releaselevel': 'beta',
-    'serial': 7
+    'releaselevel': 'final',
+    'serial': 8
 }
 
 

File viewclass_mixins/views.py

 from django.http import HttpResponseRedirect, HttpResponseForbidden
 from django.utils.decorators import method_decorator
 from django.utils.cache import patch_response_headers, patch_vary_headers
+from django.views.decorators.csrf import csrf_exempt
 
 
 class FilteredListMixin(object):
         return super(LoginMixin, self).dispatch(*args, **kwargs)
 
 
+class CsrfExemptMixin(object):
+    @method_decorator(csrf_exempt)
+    def dispatch(self, *args, **kwargs):
+        return super(CsrfExemptMixin, self).dispatch(*args, **kwargs)
+
+
 class StaffRequiredMixin(LoginMixin):
     def dispatch(self, request, *args, **kwargs):
         if request.user.is_staff: