django @csrf

    xiaoxiao2022-07-12  144

    在views.py中 

    from django.views.generic.base import View class ueditor(View): @csrf_exempt def post(self, request): print(request.POST.get('abc', "")) return render(request, "ueditor.html")

    这样写是csrf_exempt是不会生效的

    只有继承了django rest framework的apiview有才用:

    from rest_framework.views import APIView class ueditor(APIView): @csrf_exempt def post(self, request): print(request.POST.get('abc', "")) return render(request, "ueditor.html")

     

    最新回复(0)