from rest_framework.response import Responseclass APIResponse(Response):def __init__(self, code=100, msg='成功', status=None, headers=None,exception=False, content_type=None, **kwargs):real_data = {'code': code,'msg': msg,}if kwargs:real_data.update(kwargs)super().__init__(data=real_data, status=status, headers=headers,exception=exception, content_type=content_type)
调用:
# 首先导入return APIResponse()
