day69
1.自定义respose类 1.respose源码分析 reponse参数 class Response(SimpleTemplateResponse): """ An HttpResponse that allows its data to be rendered into arbitrary media types. """ def __init__(self, data=None, status=None, template_name=None, headers=None, exception=False, content_type=None): 2.自定义respose类,重写repose 重写父类方法 from rest_framework.response import Response ''' def __init__(self, data=None, status=None, template_name=None, headers=None, exception=False, content_type=None): ''' class APIResponse(Response): def __init__(self, status=0, msg='ok', http_status=None, headers=None, exception=False, *