from rest_framework.exceptions import APIException
class ServiceUnavailable(APIException):
status_code = 201
default_detail = {"username": "root", "msg": "添加用户成功"}
default_code = "service_unavaliable"
class TestView(APIView):
def get(self,request):
raise ServiceUnavailable()
django自定义异常
猜你喜欢
转载自www.cnblogs.com/xujunkai/p/12435015.html
今日推荐
周排行