当前位置:网站首页>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)
边栏推荐
- Countdownlatch blocking wait for multithreading concurrency
- Shenyu gateway development: enable and run locally
- China PBAT resin Market Forecast and Strategic Research Report (2022 Edition)
- 中国氮化硅陶瓷基板行业研究与投资前景报告(2022版)
- The amazing open source animation library is not only awesome, but also small
- 荣威 RX5 的「多一点」产品策略
- Redis6.0 new features
- (27) Open operation, close operation, morphological gradient, top hat, black hat
- China metallocene polyethylene (MPE) Industry Research Report (2022 Edition)
- 中国生物降解塑料市场预测与投资战略报告(2022版)
猜你喜欢

How to write good code - Defensive Programming Guide

(十七)DAC转换实验

GameFramework食用指南

换掉UUID,NanoID更快更安全!

Pytest learning notes (13) -allure of allure Description () and @allure title()
![[mathematical modeling] [matlab] implementation of two-dimensional rectangular packing code](/img/de/1f572c62a0d034da9a8acb5c2f9602.jpg)
[mathematical modeling] [matlab] implementation of two-dimensional rectangular packing code

美国国家安全局(NSA)“酸狐狸”漏洞攻击武器平台技术分析报告

vulnhub靶场-Hacker_Kid-v1.0.1

(28) Shape matching based on contour features

Gold, silver and four want to change jobs, so we should seize the time to make up
随机推荐
[C language foundation] 12 strings
美国国家安全局(NSA)“酸狐狸”漏洞攻击武器平台技术分析报告
(16) ADC conversion experiment
Determine whether the linked list is a palindrome linked list
How to use etcd to realize distributed /etc directory
期货先锋这个软件正规吗安全吗?选择哪家期货公司更安全?
换掉UUID,NanoID更快更安全!
Please, stop painting star! This has nothing to do with patriotism!
【C补充】【字符串】按日期排序显示一个月的日程
深度优先遍历和广度优先遍历[通俗易懂]
【splishsplash】关于如何在GUI和json上接收/显示用户参数、MVC模式和GenParam
vulnhub靶场-hacksudo - Thor
In aks, use secret in CSI driver mount key vault
National Security Agency (NSA) "sour Fox" vulnerability attack weapon platform technical analysis report
中国酶制剂市场预测与投资战略研究报告(2022版)
【牛客网刷题系列 之 Verilog快速入门】~ 优先编码器电路①
Openlayers customize bubble boxes and navigate to bubble boxes
Depth first traversal and breadth first traversal [easy to understand]
Basic usage of Frida
Girls who want to do software testing look here