Serialize a partial subset of fields in the API
Project description
Allows clients to control which fields will be sent in the API response. Fields are specified in the query, e.g.
# 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"
}
Supported Django versions: 1.7 - 3.2+. Check the CI matrix for details.
Documentation is hosted on Read The Docs.
Developers, developers, developers!
Want to contribute to the project? This is how to run the test suite:
# 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for djangorestframework-queryfields-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512516947e2d0f7b132469bc3b96b702653ed032e450d90b6efc0dc7fe031ef7 |
|
MD5 | 2a795444c3233fb9e4014320d623ce19 |
|
BLAKE2b-256 | b8838c168b6169783c41c485068ef4a606e78461c09c4ee9a04fb986c6b83c41 |
Close
Hashes for djangorestframework_queryfields-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3952e02fd800de34a0fc64963bcaf7eb1e9ad688f120b1bca5b261843323f36e |
|
MD5 | ca19a914bb2d752b7f4a1929a1aab700 |
|
BLAKE2b-256 | 319c725493f7939ee5dc49f837b9655beb4f924c723ecc54d641539d15b47e4a |