How to change status of JsonResponse in Django

前端 未结 5 367
感情败类
感情败类 2021-02-03 16:35

My API is returning a JSON object on error but the status code is HTTP 200:

response = JsonResponse({\'status         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-03 17:27

    Return an actual status

    JsonResponse(status=404, data={'status':'false','message':message})
    

提交回复
热议问题