mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Merge pull request #1887 from pipermerriam/piper/decorate_as_view_response_from_viewsets
Fix missing CSRF exemption on viewsets
This commit is contained in:
		
						commit
						1e9ea377e3
					
				| 
						 | 
					@ -20,6 +20,7 @@ from __future__ import unicode_literals
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from functools import update_wrapper
 | 
					from functools import update_wrapper
 | 
				
			||||||
from django.utils.decorators import classonlymethod
 | 
					from django.utils.decorators import classonlymethod
 | 
				
			||||||
 | 
					from django.views.decorators.csrf import csrf_exempt
 | 
				
			||||||
from rest_framework import views, generics, mixins
 | 
					from rest_framework import views, generics, mixins
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +90,7 @@ class ViewSetMixin(object):
 | 
				
			||||||
        # resolved URL.
 | 
					        # resolved URL.
 | 
				
			||||||
        view.cls = cls
 | 
					        view.cls = cls
 | 
				
			||||||
        view.suffix = initkwargs.get('suffix', None)
 | 
					        view.suffix = initkwargs.get('suffix', None)
 | 
				
			||||||
        return view
 | 
					        return csrf_exempt(view)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def initialize_request(self, request, *args, **kargs):
 | 
					    def initialize_request(self, request, *args, **kargs):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user