You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
514 B
14 lines
514 B
from rest_framework.response import Response
|
|
|
|
|
|
class APIResponse(Response):
|
|
def __init__(self, code=0, msg='', data=None, status=200, headers=None, content_type=None, **kwargs):
|
|
dic = {'code': code, 'msg': msg}
|
|
if data is not None:
|
|
dic['data'] = data
|
|
|
|
dic.update(kwargs) # 这里使用update
|
|
super().__init__(data=dic, status=status,
|
|
template_name=None, headers=headers,
|
|
exception=False, content_type=content_type)
|