Jason Christa avatar Jason Christa committed 000e6aa

add csrf exempt mixin

Comments (0)

Files changed (2)

viewclass_mixins/__init__.py

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

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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.