第一种方式
@method_decorator(csrf_exempt)
def dispatch(self, request, *args, **kwargs):
return super(NodeGroups, self).dispatch(request,*args,**kwargs)
第二种方式
@method_decorator(csrf_exempt,name=‘dispatch‘)
class ps(View):
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def xxx(request):
原文:https://www.cnblogs.com/lianghexiang/p/14894711.html