跳转到主要内容

序列化API中部分字段的子集

项目描述

gh codecov pypi womm

允许客户端控制API响应中要发送的字段。字段在查询中指定,例如。

# You want a list of users but you're only interested in the fields "id" and "username":

GET /users/?fields=id,username

[
  {
    "id": 1,
    "username": "tom"
  },
  {
    "id": 2,
    "username": "wim"
  }
]


# You want to see every field except "id" for the specific user wim:

GET /users/2/?fields!=id

{
  "username": "wim",
  "email": "hey@wimglenn.com",
  "spirit_animal": "raccoon"
}

支持的Django版本: 1.7 - 3.2+. 有关详细信息,请参阅CI矩阵

文档托管在Read The Docs

开发者,开发者,开发者!

想要为项目做出贡献?这是运行测试套件的方式

# get the codez
git clone https://github.com/wimglenn/djangorestframework-queryfields.git

# create and/or activate your virtualenv, this or something like it:
cd djangorestframework-queryfields
python3 -m venv .venv
source .venv/bin/activate

# installing the app in your venv
pip install --editable ".[dev]"
git checkout -b myfeature

# hack away, then ...
pytest

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装软件包的更多信息。

源分布

djangorestframework-queryfields-1.1.0.tar.gz (5.9 kB 查看哈希值)

上传时间:

构建分布

djangorestframework_queryfields-1.1.0-py2.py3-none-any.whl (4.4 kB 查看哈希值)

上传时间 Python 2 Python 3

由以下支持