CBV:

第一种方式

    @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):

FBV

from django.views.decorators.csrf import csrf_exempt
 
@csrf_exempt
def xxx(request):
posted on 2021-06-17 17:58  x-dai  阅读(229)  评论(0)    收藏  举报