当前位置:网站首页>DRF --- response rewrite
DRF --- response rewrite
2022-07-01 17:32:00 【I'm not big head】
# response_expestion.py
from rest_framework.views import exception_handler
from rest_framework import status
from rest_framework.response import Response
class APIResponse(Response):
def __init__(self, result=None, code=None, msg=' success ', status=None, headers=None, content_type=None, **kwargs):
dic = {
'code': code,
'msg': msg
}
if result:
dic['result'] = result
else:
dic.update(kwargs)
super().__init__(data=dict, status=status, headers=headers, content_type=None)
边栏推荐
- China BMS battery management system Market Research Report (2022 Edition)
- Intelligent operation and maintenance practice: banking business process and single transaction tracking
- Gameframework eating guide
- 多线程使用不当导致的 OOM
- Is it safe to open an ETF account online? What are the steps?
- (16) ADC conversion experiment
- JDBC: deep understanding of Preparedstatement and statement[easy to understand]
- Computed property “xxx“ was assigned to but it has no setter.
- Unity3d extended toolbar
- 手机开户股票开户安全吗?那么开户需要带些什么?
猜你喜欢
Roewe rx5's "a little more" product strategy

字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化

Why should you consider using prism

多线程并发之CountDownLatch阻塞等待

In aks, use secret in CSI driver mount key vault

【C补充】【字符串】按日期排序显示一个月的日程

GameFramework食用指南

Shenyu gateway development: enable and run locally

Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target

Redis6.0 new features
随机推荐
线上开通ETF基金账户安全吗?有哪些步骤?
【C语言补充】判断明天是哪一天(明天的日期)
Judge whether the binary tree is a binary search tree
Why should you consider using prism
Jojogan practice
SQL注入漏洞(Mysql与MSSQL特性)
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
6月刊 | AntDB数据库参与编写《数据库发展研究报告》 亮相信创产业榜单
String class
Integer array merge [JS]
Concatenate strings to get the result with the smallest dictionary order
PHP implements sensitive word filtering system "suggestions collection"
期货先锋这个软件正规吗安全吗?选择哪家期货公司更安全?
Develop those things: easycvr cluster device management page function display optimization
中国茂金属聚乙烯(mPE)行业研究报告(2022版)
Judge whether a binary tree is a balanced binary tree
(12) About time-consuming printing
Object. fromEntries()